fanglei 7 years ago
parent
commit
1cdd1bb595
  1. 55
      designer/src/com/fr/design/actions/CellSelectionAction.java
  2. 16
      designer/src/com/fr/design/actions/ElementCaseAction.java
  3. 5
      designer/src/com/fr/design/actions/SelectionListenerAction.java
  4. 15
      designer/src/com/fr/design/actions/columnrow/DSColumnConditionAction.java
  5. 28
      designer/src/com/fr/design/actions/insert/cell/AbstractCellAction.java
  6. 17
      designer/src/com/fr/design/actions/insert/cell/BiasCellAction.java
  7. 14
      designer/src/com/fr/design/actions/insert/cell/ChartCellAction.java
  8. 16
      designer/src/com/fr/design/actions/insert/cell/DSColumnCellAction.java
  9. 16
      designer/src/com/fr/design/actions/insert/cell/FormulaCellAction.java
  10. 16
      designer/src/com/fr/design/actions/insert/cell/GeneralCellAction.java
  11. 16
      designer/src/com/fr/design/actions/insert/cell/ImageCellAction.java
  12. 93
      designer/src/com/fr/design/actions/insert/cell/RichTextCellAction.java
  13. 99
      designer/src/com/fr/design/actions/insert/cell/SubReportCellAction.java
  14. 38
      designer/src/com/fr/design/dscolumn/DSColumnAdvancedEditorPane.java
  15. 84
      designer/src/com/fr/design/dscolumn/DSColumnBasicEditorPane.java
  16. 99
      designer/src/com/fr/design/dscolumn/DSColumnBasicPane.java
  17. 4
      designer/src/com/fr/design/dscolumn/DSColumnPane.java
  18. 58
      designer/src/com/fr/design/dscolumn/ResultSetGroupDockingPane.java
  19. 64
      designer/src/com/fr/design/dscolumn/SelectedConfirmedDataColumnPane.java
  20. 101
      designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java
  21. 12
      designer/src/com/fr/design/mainframe/CellWidgetPropertyPane.java
  22. 14
      designer/src/com/fr/design/mainframe/ReportFloatPane.java
  23. 4
      designer/src/com/fr/design/mainframe/cell/CellEditorPane.java
  24. 58
      designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java
  25. 20
      designer/src/com/fr/design/mainframe/errorinfo/ErrorInfoLogAppender.java
  26. 60
      designer/src/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java
  27. 8
      designer/src/com/fr/design/module/DesignerModule.java
  28. 33
      designer/src/com/fr/design/present/BarCodePane.java
  29. 4
      designer/src/com/fr/design/present/CurrencyLinePane.java
  30. 85
      designer/src/com/fr/design/widget/CellWidgetCardPane.java
  31. 21
      designer/src/com/fr/design/widget/DataModify.java
  32. 11
      designer/src/com/fr/design/widget/Operator.java
  33. 1
      designer/src/com/fr/design/widget/WidgetPane.java
  34. 7
      designer/src/com/fr/design/widget/ui/BasicWidgetPropertySettingPane.java
  35. 1
      designer/src/com/fr/design/widget/ui/ButtonDefinePane.java
  36. 36
      designer/src/com/fr/design/widget/ui/ButtonGroupDictPane.java
  37. 88
      designer/src/com/fr/design/widget/ui/CheckBoxDefinePane.java
  38. 42
      designer/src/com/fr/design/widget/ui/CheckBoxDictPane.java
  39. 51
      designer/src/com/fr/design/widget/ui/CheckBoxGroupDefinePane.java
  40. 24
      designer/src/com/fr/design/widget/ui/ComboBoxDefinePane.java
  41. 48
      designer/src/com/fr/design/widget/ui/ComboCheckBoxDefinePane.java
  42. 67
      designer/src/com/fr/design/widget/ui/CustomWritableRepeatEditorPane.java
  43. 213
      designer/src/com/fr/design/widget/ui/DateEditorDefinePane.java
  44. 13
      designer/src/com/fr/design/widget/ui/DirectWriteEditorDefinePane.java
  45. 12
      designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java
  46. 185
      designer/src/com/fr/design/widget/ui/IframeEditorDefinePane.java
  47. 28
      designer/src/com/fr/design/widget/ui/ListEditorDefinePane.java
  48. 149
      designer/src/com/fr/design/widget/ui/MultiFileEditorPane.java
  49. 74
      designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java
  50. 17
      designer/src/com/fr/design/widget/ui/RadioGroupDefinePane.java
  51. 10
      designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java
  52. 7
      designer/src/com/fr/design/widget/ui/TreeEditorDefinePane.java
  53. 17
      designer/src/com/fr/design/widget/ui/WaterMarkDictPane.java
  54. 2
      designer/src/com/fr/design/widget/ui/WritableRepeatEditorPane.java
  55. 32
      designer/src/com/fr/design/widget/ui/WriteUnableRepeatEditorPane.java
  56. 7
      designer/src/com/fr/design/widget/ui/btn/AppendRowButtonDefinePane.java
  57. 9
      designer/src/com/fr/design/widget/ui/btn/DefineAppendColumnRowPane.java
  58. 25
      designer/src/com/fr/design/widget/ui/btn/DefineDeleteColumnRowPane.java
  59. 7
      designer/src/com/fr/design/widget/ui/btn/DeleteRowButtonDefinePane.java
  60. 24
      designer/src/com/fr/design/widget/ui/btn/FreeButtonDetailPane.java
  61. 7
      designer/src/com/fr/grid/selection/CellSelection.java
  62. 5
      designer/src/com/fr/grid/selection/FloatSelection.java
  63. 2
      designer/src/com/fr/grid/selection/Selection.java
  64. 229
      designer/src/com/fr/quickeditor/CellQuickEditor.java
  65. 2
      designer/src/com/fr/quickeditor/ChartQuickEditor.java
  66. 30
      designer/src/com/fr/quickeditor/cellquick/CellBiasTextPainterEditor.java
  67. 976
      designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java
  68. 206
      designer/src/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java
  69. 40
      designer/src/com/fr/quickeditor/cellquick/CellImageQuickEditor.java
  70. 48
      designer/src/com/fr/quickeditor/cellquick/CellRichTextEditor.java
  71. 65
      designer/src/com/fr/quickeditor/cellquick/CellStringQuickEditor.java
  72. 32
      designer/src/com/fr/quickeditor/cellquick/CellSubReportEditor.java
  73. 2
      designer/src/com/fr/quickeditor/floatquick/FloatImageQuickEditor.java
  74. 7
      designer/src/com/fr/quickeditor/floatquick/FloatStringQuickEditor.java
  75. 42
      designer_base/src/com/fr/design/actions/TemplateComponentAction.java
  76. 34
      designer_base/src/com/fr/design/actions/core/ActionFactory.java
  77. 12
      designer_base/src/com/fr/design/actions/file/SwitchExistEnv.java
  78. 4
      designer_base/src/com/fr/design/border/UITitledBorder.java
  79. 12
      designer_base/src/com/fr/design/constants/UIConstants.java
  80. 2
      designer_base/src/com/fr/design/data/datapane/TableDataTree.java
  81. 0
      designer_base/src/com/fr/design/designer/properties/Decoder.java
  82. 0
      designer_base/src/com/fr/design/designer/properties/Encoder.java
  83. 6
      designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java
  84. 260
      designer_base/src/com/fr/design/gui/frpane/RegPane.java
  85. 183
      designer_base/src/com/fr/design/gui/frpane/ReportletParameterViewPane.java
  86. 1
      designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java
  87. 2
      designer_base/src/com/fr/design/gui/frpane/UITabbedPaneUI.java
  88. 3
      designer_base/src/com/fr/design/gui/ibutton/UIButtonGroup.java
  89. 2
      designer_base/src/com/fr/design/gui/ibutton/UIRadioButton.java
  90. 106
      designer_base/src/com/fr/design/gui/itableeditorpane/UITableEditorPane.java
  91. 14
      designer_base/src/com/fr/design/gui/itextfield/UITextField.java
  92. 3
      designer_base/src/com/fr/design/gui/itextfield/UITextFieldUI.java
  93. 54
      designer_base/src/com/fr/design/gui/itree/refreshabletree/TreeRootPane.java
  94. 15
      designer_base/src/com/fr/design/gui/style/FRFontPane.java
  95. 40
      designer_base/src/com/fr/design/gui/style/FormatPane.java
  96. BIN
      designer_base/src/com/fr/design/images/arrow/arrow_down.png
  97. BIN
      designer_base/src/com/fr/design/images/arrow/arrow_up.png
  98. BIN
      designer_base/src/com/fr/design/images/buttonicon/add.png
  99. BIN
      designer_base/src/com/fr/design/images/buttonicon/add_press.png
  100. BIN
      designer_base/src/com/fr/design/images/buttonicon/addicon.png
  101. Some files were not shown because too many files have changed in this diff Show More

55
designer/src/com/fr/design/actions/CellSelectionAction.java

@ -5,30 +5,33 @@ import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.Selection; import com.fr.grid.selection.Selection;
public abstract class CellSelectionAction extends ElementCaseAction { public abstract class CellSelectionAction extends ElementCaseAction {
protected CellSelectionAction(ElementCasePane t) { protected CellSelectionAction() {
super(t); }
}
protected CellSelectionAction(ElementCasePane t) {
@Override super(t);
public boolean executeActionReturnUndoRecordNeeded() { }
ElementCasePane ePane = this.getEditingComponent();
Selection s = ePane.getSelection(); @Override
public boolean executeActionReturnUndoRecordNeeded() {
// TODO ALEX_SEP instanceof i hate it ElementCasePane ePane = this.getEditingComponent();
if (s instanceof CellSelection) { Selection s = ePane.getSelection();
return executeActionReturnUndoRecordNeededWithCellSelection((CellSelection)s);
} // TODO ALEX_SEP instanceof i hate it
if (s instanceof CellSelection) {
return false; return executeActionReturnUndoRecordNeededWithCellSelection((CellSelection) s);
} }
protected abstract boolean executeActionReturnUndoRecordNeededWithCellSelection(CellSelection cs); return false;
}
@Override
public void update() { protected abstract boolean executeActionReturnUndoRecordNeededWithCellSelection(CellSelection cs);
super.update();
if (this.isEnabled()) { @Override
this.setEnabled(this.getEditingComponent().getSelection() instanceof CellSelection); public void update() {
} super.update();
} if (this.isEnabled()) {
this.setEnabled(this.getEditingComponent().getSelection() instanceof CellSelection);
}
}
} }

16
designer/src/com/fr/design/actions/ElementCaseAction.java

@ -3,17 +3,15 @@ package com.fr.design.actions;
//ElementCaseAction应该有GridSelectionChangeListener,就从悬浮元素和单元格来讲,就必须有了,用来判断这些ElementCaseAction是否可以编辑,当然还可以做些其他事情 //ElementCaseAction应该有GridSelectionChangeListener,就从悬浮元素和单元格来讲,就必须有了,用来判断这些ElementCaseAction是否可以编辑,当然还可以做些其他事情
// //
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.Selection;
import com.fr.design.selection.SelectionEvent;
import com.fr.design.selection.SelectionListener;
public abstract class ElementCaseAction extends SelectionListenerAction { public abstract class ElementCaseAction extends SelectionListenerAction {
protected ElementCaseAction(ElementCasePane t) { protected ElementCaseAction() {
super(t); }
t.addSelectionChangeListener(createSelectionListener());
} protected ElementCaseAction(ElementCasePane t) {
super(t);
t.addSelectionChangeListener(createSelectionListener());
}
} }

5
designer/src/com/fr/design/actions/SelectionListenerAction.java

@ -12,11 +12,14 @@ import com.fr.grid.selection.Selection;
*/ */
public abstract class SelectionListenerAction extends TemplateComponentAction<ElementCasePane> { public abstract class SelectionListenerAction extends TemplateComponentAction<ElementCasePane> {
protected SelectionListenerAction() {
}
protected SelectionListenerAction(ElementCasePane elementCasePane) { protected SelectionListenerAction(ElementCasePane elementCasePane) {
super(elementCasePane); super(elementCasePane);
} }
protected SelectionListener createSelectionListener () { protected SelectionListener createSelectionListener() {
return new SelectionListener() { return new SelectionListener() {
@Override @Override

15
designer/src/com/fr/design/actions/columnrow/DSColumnConditionAction.java

@ -1,21 +1,18 @@
package com.fr.design.actions.columnrow; package com.fr.design.actions.columnrow;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.actions.cell.AbstractCellElementAction; import com.fr.design.actions.cell.AbstractCellElementAction;
import com.fr.design.dscolumn.DSColumnConditionsPane; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.general.Inter; import com.fr.design.dscolumn.DSColumnConditionsPane;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.general.Inter;
import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.TemplateCellElement;
public class DSColumnConditionAction extends AbstractCellElementAction { public class DSColumnConditionAction extends AbstractCellElementAction {
private boolean returnValue = false;
private TemplateCellElement editCellElement;
public DSColumnConditionAction(ElementCasePane t) { public DSColumnConditionAction(ElementCasePane t) {
super(t); super(t);
this.setName(Inter.getLocText("Filter")); this.setName(Inter.getLocText("Filter"));
this.setMnemonic('E'); this.setMnemonic('E');
@ -23,14 +20,14 @@ public class DSColumnConditionAction extends AbstractCellElementAction {
} }
@Override @Override
protected BasicPane populateBasicPane(TemplateCellElement cellElement) { protected BasicPane populateBasicPane(TemplateCellElement cellElement) {
DSColumnConditionsPane dSColumnConditionsPane = new DSColumnConditionsPane(); DSColumnConditionsPane dSColumnConditionsPane = new DSColumnConditionsPane();
dSColumnConditionsPane.populate(DesignTableDataManager.getEditingTableDataSource(), cellElement); dSColumnConditionsPane.populate(DesignTableDataManager.getEditingTableDataSource(), cellElement);
return dSColumnConditionsPane; return dSColumnConditionsPane;
} }
@Override @Override
protected void updateBasicPane(BasicPane bp, TemplateCellElement cellElement) { protected void updateBasicPane(BasicPane bp, TemplateCellElement cellElement) {
((DSColumnConditionsPane) bp).update(cellElement); ((DSColumnConditionsPane) bp).update(cellElement);
} }
} }

28
designer/src/com/fr/design/actions/insert/cell/AbstractCellAction.java

@ -13,9 +13,12 @@ import com.fr.report.elementcase.TemplateElementCase;
* Cell. * Cell.
*/ */
public abstract class AbstractCellAction extends CellSelectionAction { public abstract class AbstractCellAction extends CellSelectionAction {
protected AbstractCellAction(ElementCasePane t) { protected AbstractCellAction() {
super(t); }
}
protected AbstractCellAction(ElementCasePane t) {
super(t);
}
public abstract Class getCellValueClass(); public abstract Class getCellValueClass();
@ -26,8 +29,8 @@ public abstract class AbstractCellAction extends CellSelectionAction {
*/ */
@Override @Override
protected boolean executeActionReturnUndoRecordNeededWithCellSelection( protected boolean executeActionReturnUndoRecordNeededWithCellSelection(
CellSelection cs) { CellSelection cs) {
ElementCasePane ePane = this.getEditingComponent(); ElementCasePane ePane = this.getEditingComponent();
//got simple cell element from column and row. //got simple cell element from column and row.
TemplateElementCase report = ePane.getEditingElementCase(); TemplateElementCase report = ePane.getEditingElementCase();
@ -37,15 +40,16 @@ public abstract class AbstractCellAction extends CellSelectionAction {
} }
return ePane.getGrid().startCellEditingAt_DEC( return ePane.getGrid().startCellEditingAt_DEC(
cs.getColumn(), cs.getColumn(),
cs.getRow(), cs.getRow(),
this.getCellValueClass(), false this.getCellValueClass(), false
); );
} }
@Override
public void update() { @Override
super.update(); public void update() {
ElementCasePane ePane = this.getEditingComponent(); super.update();
this.setEnabled(ePane.isSelectedOneCell()); ElementCasePane ePane = this.getEditingComponent();
} this.setEnabled(ePane.isSelectedOneCell());
}
} }

17
designer/src/com/fr/design/actions/insert/cell/BiasCellAction.java

@ -3,8 +3,6 @@
*/ */
package com.fr.design.actions.insert.cell; package com.fr.design.actions.insert.cell;
import javax.swing.KeyStroke;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.actions.core.WorkBookSupportable;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
@ -12,12 +10,23 @@ import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.report.cell.painter.BiasTextPainter; import com.fr.report.cell.painter.BiasTextPainter;
import javax.swing.KeyStroke;
/** /**
* Bias * Bias
*/ */
public class BiasCellAction extends AbstractCellAction implements WorkBookSupportable { public class BiasCellAction extends AbstractCellAction implements WorkBookSupportable {
public BiasCellAction(ElementCasePane t) {
super(t); public BiasCellAction() {
initAction();
}
public BiasCellAction(ElementCasePane t) {
super(t);
initAction();
}
private void initAction() {
this.setMenuKeySet(INSERT_SLOPE_LINE); this.setMenuKeySet(INSERT_SLOPE_LINE);
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); this.setName(getMenuKeySet().getMenuKeySetName()+ "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());

14
designer/src/com/fr/design/actions/insert/cell/ChartCellAction.java

@ -16,11 +16,19 @@ import javax.swing.*;
* . * .
*/ */
public class ChartCellAction extends AbstractCellAction implements WorkBookSupportable { public class ChartCellAction extends AbstractCellAction implements WorkBookSupportable {
public ChartCellAction(){
initAction();
}
public ChartCellAction(ElementCasePane t) { public ChartCellAction(ElementCasePane t) {
super(t); super(t);
this.setMenuKeySet(INSERT_CHART); initAction();
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); }
this.setMnemonic(getMenuKeySet().getMnemonic());
private void initAction() {
this.setMenuKeySet(INSERT_CHART);
this.setName(getMenuKeySet().getMenuKeySetName()+ "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/chart.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/chart.png"));
} }

16
designer/src/com/fr/design/actions/insert/cell/DSColumnCellAction.java

@ -8,13 +8,21 @@ import com.fr.general.IOUtils;
import com.fr.report.cell.cellattr.core.group.DSColumn; import com.fr.report.cell.cellattr.core.group.DSColumn;
public class DSColumnCellAction extends AbstractCellAction implements WorkBookSupportable { public class DSColumnCellAction extends AbstractCellAction implements WorkBookSupportable {
public DSColumnCellAction(ElementCasePane t) { public DSColumnCellAction() {
super(t); initAction();
}
public DSColumnCellAction(ElementCasePane t) {
super(t);
initAction();
this.setSearchText(new DSColumnPane());
}
private void initAction() {
this.setMenuKeySet(KeySetUtils.INSERT_DATA_COLUMN); this.setMenuKeySet(KeySetUtils.INSERT_DATA_COLUMN);
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_insert/bindColumn.png")); this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_insert/bindColumn.png"));
this.setSearchText(new DSColumnPane());
} }
@Override @Override

16
designer/src/com/fr/design/actions/insert/cell/FormulaCellAction.java

@ -13,10 +13,18 @@ import com.fr.general.Inter;
import javax.swing.*; import javax.swing.*;
public class FormulaCellAction extends AbstractCellAction implements WorkBookSupportable { public class FormulaCellAction extends AbstractCellAction implements WorkBookSupportable {
public FormulaCellAction(ElementCasePane t) { public FormulaCellAction() {
super(t); initAction();
}
public FormulaCellAction(ElementCasePane t) {
super(t);
initAction();
}
private void initAction() {
this.setMenuKeySet(INSERT_FORMULA); this.setMenuKeySet(INSERT_FORMULA);
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png"));
} }
@ -39,7 +47,7 @@ public class FormulaCellAction extends AbstractCellAction implements WorkBookSup
}; };
@Override @Override
public Class getCellValueClass() { public Class getCellValueClass() {
return Formula.class; return Formula.class;
} }
} }

16
designer/src/com/fr/design/actions/insert/cell/GeneralCellAction.java

@ -15,10 +15,18 @@ import javax.swing.*;
* *
*/ */
public class GeneralCellAction extends AbstractCellAction implements WorkBookSupportable { public class GeneralCellAction extends AbstractCellAction implements WorkBookSupportable {
public GeneralCellAction(ElementCasePane t) { public GeneralCellAction() {
super(t); initAction();
}
public GeneralCellAction(ElementCasePane t) {
super(t);
initAction();
}
private void initAction() {
this.setMenuKeySet(INSERT_TEXT); this.setMenuKeySet(INSERT_TEXT);
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/text.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/text.png"));
} }
@ -41,7 +49,7 @@ public class GeneralCellAction extends AbstractCellAction implements WorkBookSup
}; };
@Override @Override
public Class getCellValueClass() { public Class getCellValueClass() {
return String.class; return String.class;
} }
} }

16
designer/src/com/fr/design/actions/insert/cell/ImageCellAction.java

@ -16,10 +16,18 @@ import java.awt.*;
* Image * Image
*/ */
public class ImageCellAction extends AbstractCellAction implements WorkBookSupportable { public class ImageCellAction extends AbstractCellAction implements WorkBookSupportable {
public ImageCellAction(ElementCasePane t) { public ImageCellAction() {
super(t); initAction();
}
public ImageCellAction(ElementCasePane t) {
super(t);
initAction();
}
private void initAction() {
this.setMenuKeySet(INSERT_IMAGE); this.setMenuKeySet(INSERT_IMAGE);
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/image.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/image.png"));
} }
@ -42,7 +50,7 @@ public class ImageCellAction extends AbstractCellAction implements WorkBookSuppo
}; };
@Override @Override
public Class getCellValueClass() { public Class getCellValueClass() {
return Image.class; return Image.class;
} }
} }

93
designer/src/com/fr/design/actions/insert/cell/RichTextCellAction.java

@ -1,7 +1,5 @@
package com.fr.design.actions.insert.cell; package com.fr.design.actions.insert.cell;
import javax.swing.KeyStroke;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.actions.core.WorkBookSupportable;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
@ -10,53 +8,64 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.report.cell.cellattr.core.RichText; import com.fr.report.cell.cellattr.core.RichText;
import javax.swing.KeyStroke;
public class RichTextCellAction extends AbstractCellAction implements WorkBookSupportable { public class RichTextCellAction extends AbstractCellAction implements WorkBookSupportable {
public RichTextCellAction(ElementCasePane t) { public RichTextCellAction() {
super(t); initAction();
}
public RichTextCellAction(ElementCasePane t) {
super(t);
initAction();
}
private void initAction() {
this.setMenuKeySet(INSERT_RICHTEXT); this.setMenuKeySet(INSERT_RICHTEXT);
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon( this.setSmallIcon(BaseUtils.readIcon(
"/com/fr/design/images/m_insert/richtext.png")); "/com/fr/design/images/m_insert/richtext.png"));
} }
@Override @Override
public Class getCellValueClass() { public Class getCellValueClass() {
return RichText.class; return RichText.class;
} }
/** /**
* equals 比较 * equals 比较
* @param object *
* @return true false * @param object
*/ * @return true false
@Override */
public boolean equals(Object object) { @Override
if (this == object){ public boolean equals(Object object) {
return true; if (this == object) {
} return true;
if (!(object instanceof RichTextCellAction)){ }
return false; if (!(object instanceof RichTextCellAction)) {
} return false;
}
return ComparatorUtils.equals(this.getEditingComponent(),((RichTextCellAction)object).getEditingComponent());
} return ComparatorUtils.equals(this.getEditingComponent(), ((RichTextCellAction) object).getEditingComponent());
}
private static final MenuKeySet INSERT_RICHTEXT = new MenuKeySet() { private static final MenuKeySet INSERT_RICHTEXT = new MenuKeySet() {
@Override @Override
public char getMnemonic() { public char getMnemonic() {
return 'R'; return 'R';
} }
@Override @Override
public String getMenuName() { public String getMenuName() {
return Inter.getLocText("FR-Designer_RichText"); return Inter.getLocText("FR-Designer_RichText");
} }
@Override @Override
public KeyStroke getKeyStroke() { public KeyStroke getKeyStroke() {
return null; return null;
} }
}; };
} }

99
designer/src/com/fr/design/actions/insert/cell/SubReportCellAction.java

@ -1,7 +1,5 @@
package com.fr.design.actions.insert.cell; package com.fr.design.actions.insert.cell;
import javax.swing.KeyStroke;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
@ -9,54 +7,65 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.report.cell.cellattr.core.SubReport; import com.fr.report.cell.cellattr.core.SubReport;
import javax.swing.KeyStroke;
public class SubReportCellAction extends AbstractCellAction { public class SubReportCellAction extends AbstractCellAction {
public SubReportCellAction(ElementCasePane t) { public SubReportCellAction() {
super(t); initAction();
}
public SubReportCellAction(ElementCasePane t) {
super(t);
initAction();
}
private void initAction() {
this.setMenuKeySet(INSERT_SUB_REPORT); this.setMenuKeySet(INSERT_SUB_REPORT);
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon( this.setSmallIcon(BaseUtils.readIcon(
"/com/fr/design/images/m_insert/subReport.png")); "/com/fr/design/images/m_insert/subReport.png"));
} }
public static final MenuKeySet INSERT_SUB_REPORT = new MenuKeySet() { public static final MenuKeySet INSERT_SUB_REPORT = new MenuKeySet() {
@Override @Override
public char getMnemonic() { public char getMnemonic() {
return 'S'; return 'S';
} }
@Override @Override
public String getMenuName() { public String getMenuName() {
return Inter.getLocText("M_Insert-Sub_Report"); return Inter.getLocText("M_Insert-Sub_Report");
} }
@Override @Override
public KeyStroke getKeyStroke() { public KeyStroke getKeyStroke() {
return null; return null;
} }
}; };
/** /**
* equals 比较 * equals 比较
* @param object *
* @return true false * @param object
*/ * @return true false
@Override */
public boolean equals(Object object) { @Override
if (this == object){ public boolean equals(Object object) {
return true; if (this == object) {
} return true;
if (!(object instanceof SubReportCellAction)){ }
return false; if (!(object instanceof SubReportCellAction)) {
} return false;
}
return ComparatorUtils.equals(this.getEditingComponent(),((SubReportCellAction)object).getEditingComponent());
} return ComparatorUtils.equals(this.getEditingComponent(), ((SubReportCellAction) object).getEditingComponent());
}
@Override
public Class getCellValueClass() { @Override
return SubReport.class; public Class getCellValueClass() {
} return SubReport.class;
}
} }

38
designer/src/com/fr/design/dscolumn/DSColumnAdvancedEditorPane.java

@ -1,38 +0,0 @@
package com.fr.design.dscolumn;
import com.fr.design.mainframe.cell.CellEditorPane;
import com.fr.report.cell.TemplateCellElement;
/**
* 单元格元素 数据列 基本设置内容面板
*
* @author yaoh.wu
* @version 2017年7月25日
* @since 9.0
*/
public class DSColumnAdvancedEditorPane extends CellEditorPane {
@Override
public String getIconPath() {
return "Advanced";
}
@Override
public String title4PopupWindow() {
return "Advanced";
}
@Override
public void update() {
}
@Override
public void populate(TemplateCellElement cellElement) {
}
}

84
designer/src/com/fr/design/dscolumn/DSColumnBasicEditorPane.java

@ -1,84 +0,0 @@
package com.fr.design.dscolumn;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.cell.CellEditorPane;
import com.fr.report.cell.TemplateCellElement;
import javax.swing.*;
import java.awt.*;
/**
* 单元格元素 数据列 高级设置内容面板
*
* @author yaoh.wu
* @version 2017年7月25日
* @since 9.0
*/
public class DSColumnBasicEditorPane extends CellEditorPane {
//数据集和数据列
private SelectedDataColumnPane dataPane;
//数据分组设置
private ResultSetGroupDockingPane groupPane;
//当前编辑的单元格
private TemplateCellElement cellElement;
//条件过滤按钮面板
private JPanel conditionPane;
public DSColumnBasicEditorPane(TemplateCellElement cellElement, SelectedDataColumnPane dataPane, ResultSetGroupDockingPane groupPane, JPanel conditionPane) {
this.setLayout(new BorderLayout());
this.cellElement = cellElement;
this.dataPane = dataPane;
this.groupPane = groupPane;
this.conditionPane = conditionPane;
this.add(this.createContentPane(), BorderLayout.CENTER);
}
@Override
public String getIconPath() {
return "Basic";
}
@Override
public String title4PopupWindow() {
return "Basic";
}
@Override
public void update() {
dataPane.update(this.cellElement);
groupPane.update();
}
@Override
public void populate(TemplateCellElement cellElement) {
this.cellElement = cellElement;
dataPane.populate(null, cellElement);
groupPane.populate(cellElement);
}
/**
* 创建有内容的面板显示信息
*
* @return content JPanel
*/
private JPanel createContentPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {f};
double[] rowSize = {p, p, p};
Component[][] components = new Component[][]{
//数据集列选择
new Component[]{this.dataPane},
//数据分组设置
new Component[]{this.groupPane},
//条件过滤
new Component[]{this.conditionPane}
};
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
}
}

99
designer/src/com/fr/design/dscolumn/DSColumnBasicPane.java

@ -1,25 +1,23 @@
package com.fr.design.dscolumn; package com.fr.design.dscolumn;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.design.dialog.BasicPane;
import com.fr.design.expand.ConditionParentPane; import com.fr.design.expand.ConditionParentPane;
import com.fr.design.expand.ExpandDirectionPane; import com.fr.design.expand.ExpandDirectionPane;
import com.fr.design.layout.FRGUIPaneFactory; 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.dialog.BasicPane;
import com.fr.general.Inter;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import com.fr.report.cell.CellElement; 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.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class DSColumnBasicPane extends BasicPane { public class DSColumnBasicPane extends BasicPane {
@ -30,7 +28,7 @@ public class DSColumnBasicPane extends BasicPane {
private CellElement cellElement; private CellElement cellElement;
public DSColumnBasicPane() { public DSColumnBasicPane() {
this(DSColumnPane.SETTING_ALL); this(DSColumnPane.SETTING_ALL);
} }
public DSColumnBasicPane(int setting) { public DSColumnBasicPane(int setting) {
@ -38,44 +36,44 @@ public class DSColumnBasicPane extends BasicPane {
this.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); this.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
if (setting > DSColumnPane.SETTING_DSRELATED) { if (setting > DSColumnPane.SETTING_DSRELATED) {
selectDataColumnPane = new SelectedDataColumnPane(); selectDataColumnPane = new SelectedDataColumnPane();
} else { } else {
selectDataColumnPane = new SelectedConfirmedDataColumnPane(); selectDataColumnPane = new SelectedConfirmedDataColumnPane();
} }
selectDataColumnPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("Select_DataColumn"), null)); selectDataColumnPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("Select_DataColumn"), null));
if (setting > DSColumnPane.SETTING_DSRELATED) { if (setting > DSColumnPane.SETTING_DSRELATED) {
conditionParentPane = new ConditionParentPane(); conditionParentPane = new ConditionParentPane();
conditionParentPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("ParentCell_Setting"), null)); conditionParentPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("ParentCell_Setting"), null));
} }
resultSetGroupPane = new ResultSetGroupPopUpPane(setting > DSColumnPane.SETTING_DSRELATED); resultSetGroupPane = new ResultSetGroupPopUpPane(setting > DSColumnPane.SETTING_DSRELATED);
resultSetGroupPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("Data_Setting"), null)); resultSetGroupPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("Data_Setting"), null));
if (setting > DSColumnPane.SETTING_DSRELATED) { if (setting > DSColumnPane.SETTING_DSRELATED) {
expandDirectionPane = new ExpandDirectionPane(); expandDirectionPane = new ExpandDirectionPane();
expandDirectionPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("ExpandD-Expand_Direction"), null)); expandDirectionPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("ExpandD-Expand_Direction"), null));
} }
double[] rowSize = {TableLayout.PREFERRED, TableLayout.PREFERRED, double[] rowSize = {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[][]{
{selectDataColumnPane}, {selectDataColumnPane},
{conditionParentPane}, {conditionParentPane},
{resultSetGroupPane}, {resultSetGroupPane},
{expandDirectionPane} {expandDirectionPane}
}; };
} else { } else {
components = new Component[][]{ components = new Component[][]{
{selectDataColumnPane}, {selectDataColumnPane},
{resultSetGroupPane}, {resultSetGroupPane},
}; };
} }
this.add(TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize), BorderLayout.CENTER); this.add(TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize), BorderLayout.CENTER);
@ -85,7 +83,7 @@ public class DSColumnBasicPane extends BasicPane {
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Inter.getLocText("Basic"); return Inter.getLocText("Basic");
} }
public void populate(TableDataSource source, TemplateCellElement cellElement) { public void populate(TableDataSource source, TemplateCellElement cellElement) {
@ -99,10 +97,10 @@ public class DSColumnBasicPane extends BasicPane {
CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr();
if (conditionParentPane != null) { if (conditionParentPane != null) {
conditionParentPane.populate(cellExpandAttr); conditionParentPane.populate(cellExpandAttr);
} }
if (expandDirectionPane != null) { if (expandDirectionPane != null) {
expandDirectionPane.populate(cellExpandAttr); expandDirectionPane.populate(cellExpandAttr);
} }
resultSetGroupPane.populate(cellElement); resultSetGroupPane.populate(cellElement);
@ -128,27 +126,28 @@ public class DSColumnBasicPane extends BasicPane {
} }
if (conditionParentPane != null) { if (conditionParentPane != null) {
conditionParentPane.update(cellExpandAttr); conditionParentPane.update(cellExpandAttr);
} }
if (expandDirectionPane != null) { if (expandDirectionPane != null) {
expandDirectionPane.update(cellExpandAttr); expandDirectionPane.update(cellExpandAttr);
} }
resultSetGroupPane.update(); resultSetGroupPane.update();
} }
ActionListener summary_direction_ActionListener = new ActionListener() { ActionListener summary_direction_ActionListener = new ActionListener() {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
if (expandDirectionPane != null) { if (expandDirectionPane != null) {
expandDirectionPane.setNoneRadioButtonSelected(true); expandDirectionPane.setNoneRadioButtonSelected(true);
} }
} }
}; };
ActionListener otherGroup_direction_ActionListener = new ActionListener() { ActionListener otherGroup_direction_ActionListener = new ActionListener() {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
if (expandDirectionPane != null) { if (expandDirectionPane != null) {
expandDirectionPane.setNoneRadioButtonSelected(false); expandDirectionPane.setNoneRadioButtonSelected(false);
} }
} }
}; };
ActionListener sdcUpdate_ActionListener = new ActionListener() { ActionListener sdcUpdate_ActionListener = new ActionListener() {
@ -157,14 +156,16 @@ public class DSColumnBasicPane extends BasicPane {
selectDataColumnPane.update(cellElement); selectDataColumnPane.update(cellElement);
} }
}; };
public void putElementcase(ElementCasePane t){
if (conditionParentPane != null) { public void putElementcase(ElementCasePane t) {
conditionParentPane.putElementcase(t); if (conditionParentPane != null) {
} conditionParentPane.putElementcase(t);
} }
public void putCellElement(TemplateCellElement tplEC2) { }
if (conditionParentPane != null) {
conditionParentPane.putCellElement(tplEC2); public void putCellElement(TemplateCellElement tplCE) {
} if (conditionParentPane != null) {
} conditionParentPane.putCellElement(tplCE);
}
}
} }

4
designer/src/com/fr/design/dscolumn/DSColumnPane.java

@ -148,7 +148,7 @@ public class DSColumnPane extends BasicPane {
basicPane.putElementcase(t); basicPane.putElementcase(t);
} }
public void putCellElement(TemplateCellElement tplEC2) { public void putCellElement(TemplateCellElement tplCE) {
basicPane.putCellElement(tplEC2); basicPane.putCellElement(tplCE);
} }
} }

58
designer/src/com/fr/design/dscolumn/ResultSetGroupDockingPane.java

@ -1,35 +1,31 @@
package com.fr.design.dscolumn; package com.fr.design.dscolumn;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.FunctionComboBox; import com.fr.design.gui.icombobox.FunctionComboBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.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.general.Inter;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
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.CustomGrouper; import com.fr.report.cell.cellattr.core.group.*;
import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.report.cell.cellattr.core.group.FunctionGrouper;
import com.fr.report.cell.cellattr.core.group.RecordGrouper;
import com.fr.report.cell.cellattr.core.group.SummaryGrouper;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
/** /**
* 这个pane是选中数据列后在上方QuickRegion处显示的pane * 这个pane是选中数据列后在上方QuickRegion处显示的pane
* *
* @author zhou * @author zhou, yaoh.wu
* @version 2017年8月2日14点55分
* @since 8.0
*/ */
public class ResultSetGroupDockingPane extends ResultSetGroupPane { public class ResultSetGroupDockingPane extends ResultSetGroupPane {
private static final int BIND_GROUP = 0; private static final int BIND_GROUP = 0;
@ -42,7 +38,7 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
private CardLayout cardLayout; private CardLayout cardLayout;
private UIComboBox goBox; private UIComboBox goBox;
ItemListener l; private ItemListener listener;
public ResultSetGroupDockingPane(ElementCasePane ePane) { public ResultSetGroupDockingPane(ElementCasePane ePane) {
super(); super();
@ -58,15 +54,14 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
} }
private JPanel layoutPane() { private JPanel layoutPane() {
double vs = 4;
double vg = 6;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
UILabel dataSetLabel = new UILabel(Inter.getLocText("Data_Setting"));
dataSetLabel.setPreferredSize(new Dimension(60, 20));
Component[][] components = new Component[][] Component[][] components = new Component[][]
{ {
new Component[]{new UILabel(Inter.getLocText("Data_Setting")), goBox}, new Component[]{dataSetLabel, goBox},
new Component[]{cardPane, null} new Component[]{null, cardPane}
}; };
goBox.addItemListener(new ItemListener() { goBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent ee) { public void itemStateChanged(ItemEvent ee) {
@ -74,10 +69,13 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
int i = goBox.getSelectedIndex(); int i = goBox.getSelectedIndex();
if (i == BIND_GROUP) { if (i == BIND_GROUP) {
cardLayout.show(cardPane, "groupPane"); cardLayout.show(cardPane, "groupPane");
cardPane.setPreferredSize(new Dimension(156, 20));
} else if (i == BIND_SELECTED) { } else if (i == BIND_SELECTED) {
cardLayout.show(cardPane, "listPane"); cardLayout.show(cardPane, "listPane");
cardPane.setPreferredSize(new Dimension(0, 0));
} else if (i == BIND_SUMMARY) { } else if (i == BIND_SUMMARY) {
cardLayout.show(cardPane, "summaryPane"); cardLayout.show(cardPane, "summaryPane");
cardPane.setPreferredSize(new Dimension(156, 20));
CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr();
cellExpandAttr.setDirection(Constants.NONE); cellExpandAttr.setDirection(Constants.NONE);
} }
@ -86,7 +84,7 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
double[] columnSize = {p, f}; double[] columnSize = {p, f};
double[] rowSize = {p, p}; double[] rowSize = {p, p};
return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 8, 10);
} }
private void initCardPane() { private void initCardPane() {
@ -190,15 +188,15 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
} }
} }
public void addListener(ItemListener l) { public void addListener(ItemListener listener) {
goBox.addItemListener(l); goBox.addItemListener(listener);
groupComboBox.addItemListener(l); groupComboBox.addItemListener(listener);
functionComboBox.addItemListener(l); functionComboBox.addItemListener(listener);
this.l = l; this.listener = listener;
} }
void fireTargetChanged() { void fireTargetChanged() {
l.itemStateChanged(null); listener.itemStateChanged(null);
} }
@Override @Override

64
designer/src/com/fr/design/dscolumn/SelectedConfirmedDataColumnPane.java

@ -1,45 +1,45 @@
package com.fr.design.dscolumn; package com.fr.design.dscolumn;
import java.awt.Dimension;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.Iterator;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.design.data.datapane.TableDataComboBox; import com.fr.design.data.datapane.TableDataComboBox;
import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper; import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper;
import com.fr.main.impl.WorkBook; import com.fr.main.impl.WorkBook;
import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.TemplateCellElement;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.Iterator;
public class SelectedConfirmedDataColumnPane extends SelectedDataColumnPane { public class SelectedConfirmedDataColumnPane extends SelectedDataColumnPane {
public SelectedConfirmedDataColumnPane () { public SelectedConfirmedDataColumnPane() {
super(false); super(false);
} }
protected void initTableNameComboBox() { protected void initTableNameComboBox() {
tableNameComboBox = new TableDataComboBox(new WorkBook()); tableNameComboBox = new TableDataComboBox(new WorkBook());
tableNameComboBox.addItemListener(new ItemListener() { tableNameComboBox.addItemListener(new ItemListener() {
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
columnNameComboBox.setLoaded(false); columnNameComboBox.setLoaded(false);
} }
}); });
tableNameComboBox.setPreferredSize(new Dimension(100, 20)); tableNameComboBox.setPreferredSize(new Dimension(100, 20));
} }
public void populate(TableDataSource source, TemplateCellElement cell) { public void populate(TableDataSource source, TemplateCellElement cell) {
tableNameComboBox.refresh(source); tableNameComboBox.refresh(source);
tableNameComboBox.setEditable(false); tableNameComboBox.setEditable(false);
tableNameComboBox.setEnabled(false); tableNameComboBox.setEnabled(false);
super.populate(source, cell); super.populate(source, cell);
try { try {
Iterator it = source.getTableDataNameIterator(); Iterator it = source.getTableDataNameIterator();
String name = (String)it.next(); String name = (String) it.next();
TemplateTableDataWrapper wrapper = new TemplateTableDataWrapper(source.getTableData(name), name); TemplateTableDataWrapper wrapper = new TemplateTableDataWrapper(source.getTableData(name), name);
tableNameComboBox.setSelectedItem(wrapper); tableNameComboBox.setSelectedItem(wrapper);
tableNameComboBox.getModel().setSelectedItem(wrapper); tableNameComboBox.getModel().setSelectedItem(wrapper);
} catch (Exception e) { } catch (Exception e) {
} }
} }
} }

101
designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java

@ -17,6 +17,7 @@ import com.fr.design.gui.itableeditorpane.UITableEditorPane;
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.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.data.TableDataColumn; import com.fr.general.data.TableDataColumn;
import com.fr.report.cell.CellElement; import com.fr.report.cell.CellElement;
@ -39,8 +40,8 @@ import java.util.regex.Pattern;
* 数据集列动态参数设置组件 * 数据集列动态参数设置组件
* *
* @author yaoh.wu * @author yaoh.wu
* @version 2017年7月26 * @version 2017年8月3
* 9.0设计器更新修改动态参数注入按钮部分,使其显示动态参数按钮时能在右侧边栏正常显示 * 复用对话框代码保留对话框原始布局
* @since 8.0 * @since 8.0
*/ */
public class SelectedDataColumnPane extends BasicPane { public class SelectedDataColumnPane extends BasicPane {
@ -54,11 +55,20 @@ public class SelectedDataColumnPane extends BasicPane {
private UIButton paramButton; private UIButton paramButton;
public SelectedDataColumnPane() { public SelectedDataColumnPane() {
this(true); this(true, false, null, null);
} }
SelectedDataColumnPane(boolean showParameterButton) {
initComponent(showParameterButton); public SelectedDataColumnPane(boolean showParameterButton) {
this(showParameterButton, false, null, null);
}
public SelectedDataColumnPane(boolean showParameterButton, boolean verticalLayout, ElementCasePane casePane, TemplateCellElement cellElement) {
if (verticalLayout) {
initComponentVerticalLayout(casePane, cellElement);
} else {
initComponent(showParameterButton);
}
} }
/** /**
@ -72,33 +82,32 @@ public class SelectedDataColumnPane extends BasicPane {
initWithParameterButton(); initWithParameterButton();
} }
columnNameComboBox = new LazyComboBox() { columnNameComboBox = new LazyComboBox() {
@Override @Override
public Object[] load() { public Object[] load() {
List<String> l = calculateColumnNameList(); List<String> l = calculateColumnNameList();
return l.toArray(new String[l.size()]); return l.toArray(new String[l.size()]);
} }
}; };
columnNameComboBox.setEditable(true); columnNameComboBox.setEditable(true);
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
UILabel label1 = new UILabel(Inter.getLocText("TableData")); UILabel dsLabel = new UILabel(Inter.getLocText("TableData") + ":");
UILabel label3 = new UILabel(Inter.getLocText("DataColumn")); UILabel dcLabel = new UILabel(Inter.getLocText("DataColumn") + ":");
if (showParameterButton) { if (showParameterButton) {
//todo 国际化 dsLabel.setPreferredSize(new Dimension(200, 25));
UILabel label2 = new UILabel("param"); dcLabel.setPreferredSize(new Dimension(200, 25));
Component[][] components = { }
{label1, tableNameComboBox}, if (showParameterButton) {
{label2, paramButton}, Component[][] comps = {{dsLabel, null, dcLabel}, {tableNameComboBox, paramButton, columnNameComboBox}};
{label3, columnNameComboBox} this.add(TableLayoutHelper.createTableLayoutPane(comps, new double[]{p, p}, new double[]{p, p, p}));
};
this.setLayout(new BorderLayout());
this.add(TableLayoutHelper.createTableLayoutPane(components, new double[]{p, p, p}, new double[]{p, f}));
} else { } else {
double f = TableLayout.FILL;
double[] columnSize = {p, f}; double[] columnSize = {p, f};
double[] rowSize = {p, p}; double[] rowSize = {p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{label1, tableNameComboBox}, new Component[]{dsLabel, tableNameComboBox},
new Component[]{label3, columnNameComboBox} new Component[]{dcLabel, columnNameComboBox}
}; };
JPanel jPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel jPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
@ -107,6 +116,39 @@ public class SelectedDataColumnPane extends BasicPane {
} }
/**
* 初始化竖直布局的组件
*/
public void initComponentVerticalLayout(ElementCasePane casePane, TemplateCellElement cellElement) {
initTableNameComboBox();
initWithParameterButton(casePane, cellElement);
columnNameComboBox = new LazyComboBox() {
@Override
public Object[] load() {
List<String> l = calculateColumnNameList();
return l.toArray(new String[l.size()]);
}
};
columnNameComboBox.setEditable(true);
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
UILabel dsLabel = new UILabel(Inter.getLocText("TableData"));
UILabel dpLabel = new UILabel(Inter.getLocText("FR-Designer_Dynamic_Parameter"));
UILabel dcLabel = new UILabel(Inter.getLocText("DataColumn"));
dsLabel.setPreferredSize(new Dimension(60, 20));
dpLabel.setPreferredSize(new Dimension(60, 20));
dcLabel.setPreferredSize(new Dimension(60, 20));
Component[][] components = {
{dsLabel, tableNameComboBox},
{dpLabel, paramButton},
{dcLabel, columnNameComboBox}
};
this.setLayout(new BorderLayout());
this.add(TableLayoutHelper.createGapTableLayoutPane(components, new double[]{p, p, p}, new double[]{p, f}, 8, 10));
}
public void populate(TableDataSource source, TemplateCellElement cellElement) { public void populate(TableDataSource source, TemplateCellElement cellElement) {
if (cellElement == null) { if (cellElement == null) {
return; return;
@ -237,6 +279,27 @@ public class SelectedDataColumnPane extends BasicPane {
}); });
} }
private void initWithParameterButton(final ElementCasePane casePane, final TemplateCellElement cellElement) {
final SelectedDataColumnPane that = this;
editorPane = new UITableEditorPane<ParameterProvider>(new ParameterTableModel());
paramButton = new UIButton(Inter.getLocText("TableData_Dynamic_Parameter_Setting"));
paramButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
BasicDialog paramDialog = editorPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
List<ParameterProvider> parameterList = editorPane.update();
ps = parameterList.toArray(new Parameter[parameterList.size()]);
that.update(cellElement);
casePane.fireTargetModified();
}
});
editorPane.populate(ps == null ? new Parameter[0] : ps);
paramDialog.setVisible(true);
}
});
}
private boolean isColumnName(String columnExp) { private boolean isColumnName(String columnExp) {
return StringUtils.isNotBlank(columnExp) && (columnExp.length() > 0 && columnExp.charAt(0) == '#') && !columnExp.endsWith("#"); return StringUtils.isNotBlank(columnExp) && (columnExp.length() > 0 && columnExp.charAt(0) == '#') && !columnExp.endsWith("#");

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

@ -12,6 +12,7 @@ import com.fr.form.ui.Widget;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection; import com.fr.grid.selection.Selection;
import com.fr.privilege.finegrain.WidgetPrivilegeControl; import com.fr.privilege.finegrain.WidgetPrivilegeControl;
import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.DefaultTemplateCellElement;
@ -68,9 +69,6 @@ public class CellWidgetPropertyPane extends BasicPane {
Widget cellWidget = cellElement.getWidget(); Widget cellWidget = cellElement.getWidget();
if(cellWidget == null){
return;
}
// 这里进行克隆的原因是为了保留原始的Widget以便和新的Widget做比较来判断是否发生了改变 // 这里进行克隆的原因是为了保留原始的Widget以便和新的Widget做比较来判断是否发生了改变
if (cellWidget != null) { if (cellWidget != null) {
@ -85,8 +83,7 @@ public class CellWidgetPropertyPane extends BasicPane {
} }
public void populate(ElementCasePane ePane) { public void reInit(ElementCasePane ePane){
cellEditorDefPane = new WidgetPane(ePane); cellEditorDefPane = new WidgetPane(ePane);
this.removeAll(); this.removeAll();
this.add(cellEditorDefPane, BorderLayout.CENTER); this.add(cellEditorDefPane, BorderLayout.CENTER);
@ -102,6 +99,11 @@ public class CellWidgetPropertyPane extends BasicPane {
this.populate(editCellElement); this.populate(editCellElement);
} }
public void populate(ElementCasePane ePane) {
Selection editingSelection = ePane.getSelection();
editingSelection.populateWidgetPropertyPane(ePane);
}
public void update() { public void update() {
if (cellElement == null) {// 利用默认的CellElement. if (cellElement == null) {// 利用默认的CellElement.
return; return;

14
designer/src/com/fr/design/mainframe/ReportFloatPane.java

@ -2,6 +2,7 @@ package com.fr.design.mainframe;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.core.ActionFactory;
import com.fr.design.constants.UIConstants;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -42,7 +43,14 @@ public class ReportFloatPane extends JPanel {
UIToolbar topToolBar = new UIToolbar(); UIToolbar topToolBar = new UIToolbar();
topToolBar.setLayout(new BorderLayout()); topToolBar.setLayout(new BorderLayout());
insertFloatMenu = createInsertToolBar(); insertFloatMenu = createInsertToolBar();
topToolBar.add(createButtonUI()); topToolBar.setPreferredSize(new Dimension(155,20));
topToolBar.add(createButtonUI(), BorderLayout.CENTER);
topToolBar.setBorder(BorderFactory.createEmptyBorder(-1, -1, -1, -1));
JPanel toolBarPane = new JPanel(new BorderLayout());
toolBarPane.add(topToolBar, BorderLayout.CENTER);
toolBarPane.setBorder(BorderFactory.createLineBorder(UIConstants.POP_DIALOG_BORDER));
toolBarPane.setPreferredSize(new Dimension(155,20));
UILabel emptyLabel = new UILabel(); UILabel emptyLabel = new UILabel();
emptyLabel.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0)); emptyLabel.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0));
@ -51,10 +59,10 @@ public class ReportFloatPane extends JPanel {
double[] columnSize = {p, p, p, f}; double[] columnSize = {p, p, p, f};
double[] rowSize = {p}; double[] rowSize = {p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(), new UILabel(Inter.getLocText("FR-Designer_Add_FloatElement")), emptyLabel, topToolBar}, new Component[]{new UILabel(), new UILabel(Inter.getLocText("FR-Designer_Add_FloatElement")), emptyLabel, toolBarPane},
}; };
JPanel leftTopPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel leftTopPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
leftTopPane.setBorder(BorderFactory.createEmptyBorder(10, 4, 0, 13)); leftTopPane.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 15));
this.add(leftTopPane, BorderLayout.NORTH); this.add(leftTopPane, BorderLayout.NORTH);
} }

4
designer/src/com/fr/design/mainframe/cell/CellEditorPane.java

@ -1,7 +1,6 @@
package com.fr.design.mainframe.cell; package com.fr.design.mainframe.cell;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.report.cell.TemplateCellElement;
/** /**
* 右侧单元格元素面板抽象类 * 右侧单元格元素面板抽象类
@ -24,7 +23,6 @@ public abstract class CellEditorPane extends BasicPane {
/** /**
* 更新面板数据 * 更新面板数据
* *
* @param cellElement 单元格
*/ */
public abstract void populate(TemplateCellElement cellElement); public abstract void populate();
} }

58
designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java

@ -63,7 +63,8 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
// 插入行策略 // 插入行策略
private UIButtonGroup insertRowPolicy; private UIButtonGroup insertRowPolicy;
private ValueEditorPane valueEditor; private ValueEditorPane valueEditor;
private CardLayout insertRowLayout;
private JPanel insertRowPane;
private JPanel southContentPane; private JPanel southContentPane;
private JPanel defaultValuePane; private JPanel defaultValuePane;
@ -109,14 +110,41 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
defaultValuePane = new JPanel(new BorderLayout(4, 0)); defaultValuePane = new JPanel(new BorderLayout(4, 0));
valueEditor = ValueEditorPaneFactory.createBasicValueEditorPane(); valueEditor = ValueEditorPaneFactory.createBasicValueEditorPane();
defaultValuePane.add(valueEditor, BorderLayout.CENTER); defaultValuePane.add(valueEditor, BorderLayout.CENTER);
defaultValuePane.setVisible(false); insertRowLayout = new CardLayout();
insertRowPane = new JPanel(insertRowLayout);
insertRowPane.add(new JPanel(), "none");
insertRowPane.add(defaultValuePane, "content");
insertRowPane.setPreferredSize(new Dimension(0, 0));
insertRowPolicy.addChangeListener(new ChangeListener() { insertRowPolicy.addChangeListener(new ChangeListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
defaultValuePane.setVisible(insertRowPolicy.getSelectedIndex() == 1); if (insertRowPolicy.getSelectedIndex() == 1) {
insertRowPane.setPreferredSize(new Dimension(100, 20));
insertRowLayout.show(insertRowPane, "content");
} else {
insertRowLayout.show(insertRowPane, "none");
insertRowPane.setPreferredSize(new Dimension(0, 0));
}
} }
}); });
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize1 = {p, p};
double[] columnSize1 = {p, f};
int[][] rowCount1 = {{1, 1}, {1, 1}};
Component[][] components1 = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_CellWrite_InsertRow_Policy"), SwingConstants.LEFT), insertRowPolicy},
new Component[]{null, insertRowPane},
};
southContentPane = TableLayoutHelper.createGapTableLayoutPane(components1, rowSize1, columnSize1, rowCount1, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
JPanel seniorPane = new JPanel(new BorderLayout());
seniorPane.add(seniorUpPane(), BorderLayout.NORTH);
seniorPane.add(southContentPane, BorderLayout.CENTER);
southContentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
return seniorPane;
}
private JPanel seniorUpPane() {
JPanel fileNamePane = createNormal(); JPanel fileNamePane = createNormal();
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
@ -133,19 +161,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
new Component[]{new UILabel(Inter.getLocText("FR-Designer_CellWrite_ToolTip"), SwingConstants.RIGHT), tooltipTextField}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_CellWrite_ToolTip"), SwingConstants.RIGHT), tooltipTextField},
new Component[]{null, null}, new Component[]{null, null},
}; };
JPanel seniorCenterPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
double[] rowSize1 = {p, p};
double[] columnSize1 = {p, f};
int[][] rowCount1 = {{1, 1}, {1, 1}};
Component[][] components1 = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_CellWrite_InsertRow_Policy"), SwingConstants.LEFT), insertRowPolicy},
new Component[]{null, defaultValuePane},
};
southContentPane = TableLayoutHelper.createGapTableLayoutPane(components1, rowSize1, columnSize1, rowCount1, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
JPanel seniorPane = new JPanel(new BorderLayout());
seniorPane.add(seniorCenterPane, BorderLayout.NORTH);
seniorPane.add(southContentPane, BorderLayout.CENTER);
return seniorPane;
} }
private JPanel pagePane() { private JPanel pagePane() {
@ -305,7 +321,13 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
} else { } else {
insertRowPolicy.setSelectedIndex(0); insertRowPolicy.setSelectedIndex(0);
} }
defaultValuePane.setVisible(insertRowPolicy.getSelectedIndex() == 1); if (insertRowPolicy.getSelectedIndex() == 1) {
insertRowPane.setPreferredSize(new Dimension(100, 20));
insertRowLayout.show(insertRowPane, "content");
} else {
insertRowLayout.show(insertRowPane, "none");
insertRowPane.setPreferredSize(new Dimension(0, 0));
}
southContentPane.setVisible(true); southContentPane.setVisible(true);
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (!jTemplate.isJWorkBook()) { //表单中报表块编辑屏蔽掉 插入行策略 if (!jTemplate.isJWorkBook()) { //表单中报表块编辑屏蔽掉 插入行策略

20
designer/src/com/fr/design/mainframe/errorinfo/ErrorInfoLogAppender.java

@ -6,6 +6,7 @@ import com.fr.base.io.XMLReadHelper;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.general.FRLogLevel; import com.fr.general.FRLogLevel;
import com.fr.general.FRLogManager; import com.fr.general.FRLogManager;
import com.fr.general.Inter;
import com.fr.general.LogDuration; import com.fr.general.LogDuration;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
@ -75,16 +76,17 @@ public class ErrorInfoLogAppender extends AppenderSkeleton {
} }
private String readLogID(String log) { private String readLogID(String log) {
int dotIndex = log.lastIndexOf(":"); String errorCode = Inter.getLocText("FR-Engine_ErrorCode-Prefix");
if (dotIndex != -1) { String[] matchs = log.split(errorCode + ".*?:");
int end = Math.min(dotIndex + ERROR_LEN, log.length()); if (matchs.length <= 1) {
String logid = log.substring(dotIndex + 1, end).trim(); return StringUtils.EMPTY;
try { }
Long.parseLong(logid);
return logid; String includeIDStr = matchs[1].trim();
} catch (Exception ignore) { try {
return Long.parseLong(includeIDStr.substring(0, ERROR_LEN)) + StringUtils.EMPTY;
} catch (Exception ignore) {
}
} }
return StringUtils.EMPTY; return StringUtils.EMPTY;

60
designer/src/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java

@ -1,7 +1,9 @@
package com.fr.design.mainframe.errorinfo; package com.fr.design.mainframe.errorinfo;
import com.fr.base.FRContext;
import com.fr.general.*; import com.fr.general.*;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.json.JSONException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.stable.CodeUtils; import com.fr.stable.CodeUtils;
import com.fr.stable.EnvChangedListener; import com.fr.stable.EnvChangedListener;
@ -10,6 +12,8 @@ import com.fr.stable.StableUtils;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
import java.util.HashMap; import java.util.HashMap;
@ -45,7 +49,63 @@ public class ErrorInfoUploader {
return collector; return collector;
} }
// 从云中心更新最新的解决方案文件
private void checkUpdateSolution(){
Thread updateThread = new Thread(new Runnable() {
@Override
public void run() {
String localCacheFilePath = StableUtils.pathJoin(ProductConstants.getEnvHome(), "solution", "solution.zip");
File localCacheZip = new File(localCacheFilePath);
if (needUpdate(localCacheZip)) {
downloadSolution(localCacheZip);
}
}
});
updateThread.start();
}
private void downloadSolution(File localCacheZip) {
try {
String downloadURL = SiteCenter.getInstance().acquireUrlByKind("solution.download", "http://cloud.fanruan.com/api/solution");
HttpClient hc = new HttpClient(downloadURL);
hc.asGet();
InputStream in = hc.getResponseStream();
StableUtils.makesureFileExist(localCacheZip);
FileOutputStream out = new FileOutputStream(localCacheZip);
IOUtils.copyBinaryTo(in, out);
out.close();
in.close();
IOUtils.unzip(localCacheZip, localCacheZip.getParent());
} catch (Exception e) {
FRContext.getLogger().debug(e.getMessage());
}
}
private boolean needUpdate(File localCacheZip){
if (localCacheZip.exists()) {
// 判断本地文件大小.
String checkURL = SiteCenter.getInstance().acquireUrlByKind("solution.check", "http://cloud.fanruan.com/api/checkUpdate");
HttpClient client = new HttpClient(checkURL);
client.asGet();
if (client.isServerAlive()){
try {
JSONObject res = new JSONObject(client.getResponseText());
// 简单粗暴, 直接判断文件大小.
return res.optLong("version") != localCacheZip.length();
} catch (JSONException ignore) {
}
}
return false;
}
return true;
}
public void sendErrorInfo(){ public void sendErrorInfo(){
// 判断更新解决方案缓存.
checkUpdateSolution();
//读取文件夹里的json, 加入上传队列中. //读取文件夹里的json, 加入上传队列中.
File folder = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), FOLDER_NAME)); File folder = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), FOLDER_NAME));
if (!folder.exists()) { if (!folder.exists()) {

8
designer/src/com/fr/design/module/DesignerModule.java

@ -111,7 +111,7 @@ public class DesignerModule extends DesignModule {
private void registerCellEditor() { private void registerCellEditor() {
ActionFactory.registerCellEditor(String.class, CellStringQuickEditor.class); ActionFactory.registerCellEditor(String.class, CellStringQuickEditor.class);
ActionFactory.registerCellEditor(Number.class, CellStringQuickEditor.class); ActionFactory.registerCellEditor(Number.class, CellStringQuickEditor.class);
ActionFactory.registerCellEditor(Formula.class, CellStringQuickEditor.class); ActionFactory.registerCellEditor(Formula.class, CellFormulaQuickEditor.class);
ActionFactory.registerCellEditor(SubReport.class, CellSubReportEditor.class); ActionFactory.registerCellEditor(SubReport.class, CellSubReportEditor.class);
ActionFactory.registerCellEditor(RichText.class, CellRichTextEditor.class); ActionFactory.registerCellEditor(RichText.class, CellRichTextEditor.class);
ActionFactory.registerCellEditor(DSColumn.class, CellDSColumnEditor.class); ActionFactory.registerCellEditor(DSColumn.class, CellDSColumnEditor.class);
@ -169,7 +169,7 @@ public class DesignerModule extends DesignModule {
} }
@Override @Override
/** /*
* 针对不同的对象在读取Object对象的xml的时候需要使用不同的对象生成器 * 针对不同的对象在读取Object对象的xml的时候需要使用不同的对象生成器
* @return 返回对象生成器 * @return 返回对象生成器
*/ */
@ -242,7 +242,7 @@ public class DesignerModule extends DesignModule {
} }
@Override @Override
/** /*
* 返回设计器能打开的模板类型的一个数组列表 * 返回设计器能打开的模板类型的一个数组列表
* @return 可以打开的模板类型的数组 * @return 可以打开的模板类型的数组
*/ */
@ -385,7 +385,7 @@ public class DesignerModule extends DesignModule {
} }
public Class<?>[] actionsForInsertCellElement() { public Class<?>[] actionsForInsertCellElement() {
return (Class<?>[])ArrayUtils.addAll(new Class<?>[]{ return (Class<?>[]) ArrayUtils.addAll(new Class<?>[]{
DSColumnCellAction.class, DSColumnCellAction.class,
GeneralCellAction.class, GeneralCellAction.class,
RichTextCellAction.class, RichTextCellAction.class,

33
designer/src/com/fr/design/present/BarCodePane.java

@ -2,6 +2,7 @@ package com.fr.design.present;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.border.UIRoundedBorder; import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
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;
@ -85,7 +86,7 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
RCodesizespinner = new UIBasicSpinner(new SpinnerNumberModel(2, 1, 6, 1)); RCodesizespinner = new UIBasicSpinner(new SpinnerNumberModel(2, 1, 6, 1));
RCodeVersionComboBox = new UIComboBox(); RCodeVersionComboBox = new UIComboBox();
RCodeErrorCorrectComboBox = new UIComboBox(); RCodeErrorCorrectComboBox = new UIComboBox();
typeSetLabel = new UILabel(Inter.getLocText("Type_Set") + ":", UILabel.RIGHT); typeSetLabel = new UILabel(Inter.getLocText("Type_Set"), UILabel.LEFT);
initVersionComboBox(); initVersionComboBox();
initErrorCorrectComboBox(); initErrorCorrectComboBox();
@ -95,7 +96,9 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {p, f}; double[] columnSize = {p, f};
double[] rowSize = {p, p, p, p, p, p, p, p}; double[] rowSize = {p, p, p, p, p, p, p, p};
int[][] rowCount = {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}};
barCodePreviewPane.setPreferredSize(new Dimension(0, 125)); barCodePreviewPane.setPreferredSize(new Dimension(0, 125));
typeComboBox.setPreferredSize(new Dimension(155,20));
final JPanel centerPane = new JPanel(new CardLayout()); final JPanel centerPane = new JPanel(new CardLayout());
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
@ -103,7 +106,7 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
new Component[]{borderPane, null}, new Component[]{borderPane, null},
new Component[]{centerPane, null} new Component[]{centerPane, null}
}; };
JPanel barCode = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel barCode = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_LARGE);
centerPane.add(getNormalPane(), "normal"); centerPane.add(getNormalPane(), "normal");
centerPane.add(getSpecialPane(), "special"); centerPane.add(getSpecialPane(), "special");
typeComboBox.addItemListener(new ItemListener() { typeComboBox.addItemListener(new ItemListener() {
@ -145,21 +148,23 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p, p, p, p}; double[] rowSize = {p, p, p, p, p, p, p, p};
double[] columnSize1 = {p, f, f}; double[] columnSize = {p, f, f};
int[][] rowCount = {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}};
JPanel barWidthContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 0)); JPanel barWidthContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 0));
barWidthContainer.add(barWidthSpinner); barWidthContainer.add(barWidthSpinner);
JPanel barHeightContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 0)); JPanel barHeightContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 0));
barHeightContainer.add(barHeightSpinner); barHeightContainer.add(barHeightSpinner);
UILabel uiLabel = new UILabel(Inter.getLocText("Tree-Width") + ":", UILabel.RIGHT); UILabel uiLabel = new UILabel(Inter.getLocText("FR-Designer-Tree_Width"), UILabel.RIGHT);
uiLabel.setPreferredSize(typeSetLabel.getPreferredSize()); uiLabel.setPreferredSize(typeSetLabel.getPreferredSize());
drawingTextCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
Component[][] components_normal = new Component[][]{ Component[][] components_normal = new Component[][]{
new Component[]{new UILabel("条形码大小", UILabel.LEFT), barWidthContainer, barHeightContainer}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_Barcode_Size"), UILabel.LEFT), barWidthContainer, barHeightContainer},
new Component[]{null, new UILabel(Inter.getLocText("Tree-Width"), UILabel.CENTER), new UILabel(Inter.getLocText("Height"), UILabel.CENTER)}, new Component[]{null, new UILabel(Inter.getLocText("FR-Designer-Tree_Width"), UILabel.CENTER), new UILabel(Inter.getLocText("FR-Designer_Height"), UILabel.CENTER)},
new Component[]{drawingTextCheckBox, null, null} new Component[]{drawingTextCheckBox, null, null}
}; };
JPanel normalPane = TableLayoutHelper.createTableLayoutPane(components_normal, rowSize, columnSize1); JPanel normalPane = TableLayoutHelper.createGapTableLayoutPane(components_normal, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_LARGE);
return normalPane; return normalPane;
} }
@ -167,17 +172,21 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
private JPanel getSpecialPane() { private JPanel getSpecialPane() {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize1 = {p, p}; double[] columnSize = {p, p};
double[] rowSize = {p, p, p, p, p, p, p, p}; double[] rowSize = {p, p, p, p, p, p, p, p};
UILabel uiLabel = new UILabel(Inter.getLocText("RCodeVersion") + ":", UILabel.RIGHT); int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
UILabel uiLabel = new UILabel(Inter.getLocText("RCodeVersion"), UILabel.LEFT);
uiLabel.setPreferredSize(typeSetLabel.getPreferredSize()); uiLabel.setPreferredSize(typeSetLabel.getPreferredSize());
RCodeVersionComboBox.setPreferredSize(new Dimension(155,20));
RCodeErrorCorrectComboBox.setPreferredSize(new Dimension(155,20));
RCodesizespinner.setPreferredSize(new Dimension(155,20));
Component[][] components_special = new Component[][]{ Component[][] components_special = new Component[][]{
new Component[]{uiLabel, RCodeVersionComboBox}, new Component[]{uiLabel, RCodeVersionComboBox},
new Component[]{new UILabel(Inter.getLocText("RCodeErrorCorrect") + ":", UILabel.RIGHT), RCodeErrorCorrectComboBox}, new Component[]{new UILabel(Inter.getLocText("RCodeErrorCorrect"), UILabel.LEFT), RCodeErrorCorrectComboBox},
new Component[]{new UILabel(Inter.getLocText("RCodeDrawPix") + ":", UILabel.RIGHT), RCodesizespinner} new Component[]{new UILabel(Inter.getLocText("RCodeDrawPix"), UILabel.LEFT), RCodesizespinner}
}; };
JPanel specialPane = TableLayoutHelper.createTableLayoutPane(components_special, rowSize, columnSize1); JPanel specialPane = TableLayoutHelper.createGapTableLayoutPane(components_special, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_LARGE);
return specialPane; return specialPane;
} }

4
designer/src/com/fr/design/present/CurrencyLinePane.java

@ -72,11 +72,11 @@ public class CurrencyLinePane extends FurtherBasicBeanPane<CurrencyLinePresent>
protected void initComponents() { protected void initComponents() {
// 整数位选择 // 整数位选择
intPartSpinner = new UIBasicSpinner(new SpinnerNumberModel(9, 1, 20, 1)); intPartSpinner = new UIBasicSpinner(new SpinnerNumberModel(9, 1, 20, 1));
intPartSpinner.setPreferredSize(new Dimension(135, 20)); intPartSpinner.setPreferredSize(new Dimension(158, 20));
// 小数位选择 // 小数位选择
deciPartSpinner = new UIBasicSpinner(new SpinnerNumberModel(2, 1, 10, 1)); deciPartSpinner = new UIBasicSpinner(new SpinnerNumberModel(2, 1, 10, 1));
deciPartSpinner.setPreferredSize(new Dimension(135, 20)); deciPartSpinner.setPreferredSize(new Dimension(158, 20));
// 预览区域 // 预览区域
textField = new UITextField(10); textField = new UITextField(10);

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

@ -3,14 +3,11 @@ package com.fr.design.widget;
import com.fr.design.data.DataCreatorUI; import com.fr.design.data.DataCreatorUI;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.frpane.TreeSettingPane;
import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.present.dict.DictionaryPane;
import com.fr.design.widget.ui.BasicWidgetPropertySettingPane; import com.fr.design.widget.ui.BasicWidgetPropertySettingPane;
import com.fr.form.event.Listener; import com.fr.form.event.Listener;
import com.fr.form.ui.NoneWidget;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -36,14 +33,6 @@ public class CellWidgetCardPane extends BasicPane {
private JPanel attriCardPane; private JPanel attriCardPane;
private CardLayout attriCardLayout; private CardLayout attriCardLayout;
//数字字典属性容器
private JPanel dictTabPane;
private JPanel dictCardPane;
private CardLayout dictCardLayout;
//构建树属性容器
private JPanel treeTabPane;
//事件属性容器 //事件属性容器
private JPanel eventTabPane; private JPanel eventTabPane;
private WidgetEventPane eventPane; private WidgetEventPane eventPane;
@ -52,11 +41,6 @@ public class CellWidgetCardPane extends BasicPane {
public CellWidgetCardPane(ElementCasePane pane) { public CellWidgetCardPane(ElementCasePane pane) {
this.pane = pane; this.pane = pane;
// this.initComponents(pane);
}
public BasicWidgetPropertySettingPane initBasicWidgetPropertyPane() {
return new BasicWidgetPropertySettingPane();
} }
@ -88,16 +72,6 @@ public class CellWidgetCardPane extends BasicPane {
tabsHeaderIconPane.setNeedLeftRightOutLine(false); tabsHeaderIconPane.setNeedLeftRightOutLine(false);
this.add(tabsHeaderIconPane, BorderLayout.NORTH); this.add(tabsHeaderIconPane, BorderLayout.NORTH);
//数据字典
dictTabPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
dictCardPane = FRGUIPaneFactory.createCardLayout_S_Pane();
dictTabPane.add(dictCardPane, BorderLayout.CENTER);
dictCardLayout = new CardLayout();
dictCardPane.setLayout(dictCardLayout);
//构建树
treeTabPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
widgetPropertyPane = new BasicWidgetPropertySettingPane(); widgetPropertyPane = new BasicWidgetPropertySettingPane();
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Basic"), 280, 24, widgetPropertyPane); UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Basic"), 280, 24, widgetPropertyPane);
@ -124,31 +98,12 @@ public class CellWidgetCardPane extends BasicPane {
public void populate(Widget cellWidget) { public void populate(Widget cellWidget) {
initComponents(pane); initComponents(pane);
// super.populate(cellWidget);
currentEditorDefinePane = null; currentEditorDefinePane = null;
if (cellWidget instanceof NoneWidget) {
// this.tabbedPane.setEnabled(false);
} else {
// this.tabbedPane.setEnabled(true);
}
WidgetDefinePaneFactory.RN rn = WidgetDefinePaneFactory.createWidgetDefinePane(cellWidget, new Operator() { WidgetDefinePaneFactory.RN rn = WidgetDefinePaneFactory.createWidgetDefinePane(cellWidget, new Operator() {
@Override @Override
public void did(DataCreatorUI ui, String cardName) { public void did(DataCreatorUI ui, String cardName) {
if (ui == null) { //todo
removeDictAttriPane();
removeTreeAttriPane();
}
if (ui instanceof DictionaryPane) {
removeDictAttriPane();
removeTreeAttriPane();
showDictPane(ui, cardName);
} else if (ui instanceof TreeSettingPane) {
removeDictAttriPane();
removeTreeAttriPane();
showTreePane(ui);
}
} }
}); });
DataModify<? extends Widget> definePane = rn.getDefinePane(); DataModify<? extends Widget> definePane = rn.getDefinePane();
@ -160,19 +115,6 @@ public class CellWidgetCardPane extends BasicPane {
tabsHeaderIconPane.setSelectedIndex(0); tabsHeaderIconPane.setSelectedIndex(0);
} }
private void showDictPane(DataCreatorUI ui, String cardName) {
dictCardPane.removeAll();
dictCardPane.add(ui.toSwingComponent(), cardName);
dictCardLayout.show(dictCardPane, cardName);
addDictAttriPane();
}
private void showTreePane(DataCreatorUI ui) {
treeTabPane.removeAll();
treeTabPane.add(ui.toSwingComponent());
addTreeAttriPane();
}
public Widget update() { public Widget update() {
if (currentEditorDefinePane == null) { if (currentEditorDefinePane == null) {
return null; return null;
@ -182,7 +124,6 @@ public class CellWidgetCardPane extends BasicPane {
return null; return null;
} }
widgetPropertyPane.update(widget); widgetPropertyPane.update(widget);
// super.update(widget);
Listener[] listener = eventPane == null ? new Listener[0] : eventPane.updateListeners(); Listener[] listener = eventPane == null ? new Listener[0] : eventPane.updateListeners();
widget.clearListeners(); widget.clearListeners();
@ -203,28 +144,4 @@ public class CellWidgetCardPane extends BasicPane {
eventPane.checkValid(); eventPane.checkValid();
} }
private void addDictAttriPane() {
center.add(this.dictTabPane, Inter.getLocText("FR-Designer_DS_Dictionary"));
reInitHeaderPane(this.dictTabPane);
}
private void addTreeAttriPane() {
center.add(this.dictTabPane, Inter.getLocText("FR-Designer_Create_Tree"));
reInitHeaderPane(this.treeTabPane);
}
private void removeDictAttriPane() {
center.remove(this.dictTabPane);
}
private void removeTreeAttriPane() {
center.remove(this.treeTabPane);
}
private void reInitHeaderPane(JPanel jPanel) {
paneList.add(jPanel);
// tabsHeaderIconPane = new
}
} }

21
designer/src/com/fr/design/widget/DataModify.java

@ -1,21 +0,0 @@
package com.fr.design.widget;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.gui.frpane.TreeSettingPane;
import com.fr.design.present.dict.DictionaryPane;
import com.fr.form.ui.Widget;
import javax.swing.*;
public interface DataModify<T> {
void populateBean(T ob);
T updateBean();
void checkValid() throws Exception;
DataCreatorUI dataUI();
JComponent toSwingComponent();
}

11
designer/src/com/fr/design/widget/Operator.java

@ -1,11 +0,0 @@
package com.fr.design.widget;
import com.fr.design.data.DataCreatorUI;
/**
* Created by richie on 15/11/16.
*/
public interface Operator {
void did(DataCreatorUI ui, String cardName);
}

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

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

7
designer/src/com/fr/design/widget/ui/BasicWidgetPropertySettingPane.java

@ -24,13 +24,18 @@ public class BasicWidgetPropertySettingPane extends BasicPane {
public BasicWidgetPropertySettingPane() { public BasicWidgetPropertySettingPane() {
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
enableCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Visible"), true); enableCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Visible"), true);
enableCheckBox.setBorder(BorderFactory.createEmptyBorder(0,0,0,0));
visibleCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Widget-Visible"), true); visibleCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Widget-Visible"), true);
visibleCheckBox.setBorder(BorderFactory.createEmptyBorder(0,0,0,0));
widgetNameComboBox = new ParameterTreeComboBox(); widgetNameComboBox = new ParameterTreeComboBox();
widgetNameComboBox.refreshTree(); widgetNameComboBox.refreshTree();
JPanel widgetNamePane = new JPanel(new BorderLayout());
widgetNamePane.add(widgetNameComboBox, BorderLayout.CENTER);
widgetNamePane.setBorder(BorderFactory.createEmptyBorder(0,20,0,0));
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Form-Widget_Name") + " "), widgetNameComboBox}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_Form-Widget_Name")), widgetNamePane},
new Component[]{enableCheckBox, null}, new Component[]{enableCheckBox, null},
new Component[]{visibleCheckBox, null}, new Component[]{visibleCheckBox, null},
}; };

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

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

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

@ -1,16 +1,22 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import com.fr.data.Dictionary;
import com.fr.design.gui.ispinner.UIBasicSpinner; import com.fr.design.gui.ispinner.UIBasicSpinner;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import javax.swing.SpinnerNumberModel; import javax.swing.*;
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.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.accessibles.AccessibleDictionaryEditor;
import com.fr.form.ui.ButtonGroup; import com.fr.form.ui.ButtonGroup;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -19,6 +25,8 @@ public class ButtonGroupDictPane extends JPanel {
private UIBasicSpinner columnSpinner; private UIBasicSpinner columnSpinner;
private UICheckBox adaptiveCheckbox; private UICheckBox adaptiveCheckbox;
private UILabel columnLabel; private UILabel columnLabel;
private AccessibleDictionaryEditor dictPane;
public ButtonGroupDictPane() { public ButtonGroupDictPane() {
this.initComponents(); this.initComponents();
@ -28,23 +36,36 @@ public class ButtonGroupDictPane extends JPanel {
* *
*/ */
public void initComponents() { public void initComponents() {
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); dictPane = new AccessibleDictionaryEditor();
this.setLayout(FRGUIPaneFactory.createBorderLayout());
adaptiveCheckbox = new UICheckBox(Inter.getLocText("Adaptive"), true); adaptiveCheckbox = new UICheckBox(Inter.getLocText("Adaptive"), true);
adaptiveCheckbox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
adaptiveCheckbox.addActionListener(new ActionListener() { adaptiveCheckbox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
columnSpinner.setVisible(!adaptiveCheckbox.isSelected()); columnSpinner.setVisible(!adaptiveCheckbox.isSelected());
columnLabel.setVisible(!adaptiveCheckbox.isSelected()); columnLabel.setVisible(!adaptiveCheckbox.isSelected());
} }
}); });
this.add(adaptiveCheckbox);
this.columnLabel = new UILabel(Inter.getLocText("Button-Group-Display-Columns") + ":"); this.columnLabel = new UILabel(Inter.getLocText("Button-Group-Display-Columns") + ":");
this.add(columnLabel);
columnSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, 0, Integer.MAX_VALUE, 1)); columnSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, 0, Integer.MAX_VALUE, 1));
this.add(columnSpinner);
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double rowSize[] = {p, p};
double columnSize[] = {p, p, f};
Component[][] n_components = {
{new UILabel(Inter.getLocText("FR-Designer_DS-Dictionary")), dictPane, null},
{adaptiveCheckbox, columnLabel, columnSpinner}
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, 16, 8);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
this.add(panel);
} }
public void populate(ButtonGroup buttonGroup) { public void populate(ButtonGroup buttonGroup) {
dictPane.setValue(buttonGroup.getDictionary());
adaptiveCheckbox.setSelected(buttonGroup.isAdaptive()); adaptiveCheckbox.setSelected(buttonGroup.isAdaptive());
columnSpinner.setVisible(!adaptiveCheckbox.isSelected()); columnSpinner.setVisible(!adaptiveCheckbox.isSelected());
columnLabel.setVisible(!adaptiveCheckbox.isSelected()); columnLabel.setVisible(!adaptiveCheckbox.isSelected());
@ -52,6 +73,7 @@ public class ButtonGroupDictPane extends JPanel {
} }
public void update(ButtonGroup buttonGroup) { public void update(ButtonGroup buttonGroup) {
buttonGroup.setDictionary((Dictionary) this.dictPane.getValue());
buttonGroup.setAdaptive(adaptiveCheckbox.isSelected()); buttonGroup.setAdaptive(adaptiveCheckbox.isSelected());
buttonGroup.setColumnsInRow((Integer)(columnSpinner.getValue())); buttonGroup.setColumnsInRow((Integer)(columnSpinner.getValue()));
} }

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

@ -1,48 +1,62 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import javax.swing.*;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.CheckBox; import com.fr.form.ui.CheckBox;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> { public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> {
private UITextField text; private UITextField text;
public CheckBoxDefinePane() { public CheckBoxDefinePane() {
this.iniComoponents(); this.iniComoponents();
} }
private void iniComoponents() { private void iniComoponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 8)); text = new UITextField(8);
JPanel textPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel panel = new JPanel(new BorderLayout());
textPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); panel.add(text, BorderLayout.CENTER);
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, textPane); panel.setBorder(BorderFactory.createEmptyBorder(0, 35, 0, 0));
textPane.add(new UILabel(Inter.getLocText("Text") + ":"));
text = new UITextField(8); double f = TableLayout.FILL;
textPane.add(text); double p = TableLayout.PREFERRED;
this.add(uiExpandablePane); Component[][] components = new Component[][]{
} new Component[]{new UILabel(Inter.getLocText("FR-Designer_Text")), panel},
};
@Override double[] rowSize = {p};
protected String title4PopupWindow() { double[] columnSize = {p, f};
return "CheckBox"; int[][] rowCount = {{1, 1}};
} JPanel pane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_LARGE);
@Override UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 24, pane);
public void populateBean(CheckBox check) { pane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 15));
text.setText(check.getText());
} this.add(uiExpandablePane);
}
@Override
public CheckBox updateBean() { @Override
CheckBox box = new CheckBox(); protected String title4PopupWindow() {
box.setText(text.getText()); return "CheckBox";
return box; }
}
@Override
public void populateBean(CheckBox check) {
text.setText(check.getText());
}
@Override
public CheckBox updateBean() {
CheckBox box = new CheckBox();
box.setText(text.getText());
return box;
}
} }

42
designer/src/com/fr/design/widget/ui/CheckBoxDictPane.java

@ -1,16 +1,15 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import java.awt.BorderLayout; import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel; import javax.swing.JPanel;
import com.fr.design.gui.icombobox.UIComboBox;
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.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.CheckBoxGroup; import com.fr.form.ui.CheckBoxGroup;
import com.fr.form.ui.ComboCheckBox; import com.fr.form.ui.ComboCheckBox;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -18,7 +17,7 @@ import com.fr.general.Inter;
public class CheckBoxDictPane extends JPanel { public class CheckBoxDictPane extends JPanel {
private DictionaryComboBox delimiterComboBox; private DictionaryComboBox delimiterComboBox;
private UIComboBox returnTypeComboBox; private UIButtonGroup returnTypeComboBox;
private DictionaryComboBox startComboBox; private DictionaryComboBox startComboBox;
private DictionaryComboBox endComboBox; private DictionaryComboBox endComboBox;
@ -27,42 +26,33 @@ public class CheckBoxDictPane extends JPanel {
private JPanel endPane; private JPanel endPane;
public CheckBoxDictPane() { public CheckBoxDictPane() {
JPanel returnTypePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); this.setLayout(FRGUIPaneFactory.createBorderLayout());
returnTypePane.add(new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type") + ":"), BorderLayout.WEST); JPanel returnTypePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
returnTypeComboBox = new UIComboBox(new String[]{Inter.getLocText("Widget-Array"), Inter.getLocText("String")});
returnTypePane.add(returnTypeComboBox, BorderLayout.CENTER);
this.add(returnTypePane);
delimiterPane =FRGUIPaneFactory.createBorderLayout_S_Pane(); delimiterPane =FRGUIPaneFactory.createBorderLayout_S_Pane();
UILabel label = new UILabel(Inter.getLocText("Form-Delimiter") + ":"); UILabel label = new UILabel(Inter.getLocText("Form-Delimiter") + ":");
delimiterPane.add(label, BorderLayout.WEST); delimiterPane.add(label, BorderLayout.WEST);
delimiterPane.add(delimiterComboBox = new DictionaryComboBox(DictionaryConstants.delimiters, DictionaryConstants.delimiterDisplays), BorderLayout.CENTER); delimiterPane.add(delimiterComboBox = new DictionaryComboBox(DictionaryConstants.delimiters, DictionaryConstants.delimiterDisplays), BorderLayout.CENTER);
delimiterComboBox.setEditable(true); delimiterComboBox.setEditable(true);
this.add(delimiterPane);
startPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); startPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
startPane.add(new UILabel(Inter.getLocText("ComboCheckBox-Start_Symbol") + ":"), BorderLayout.WEST); startPane.add(new UILabel(Inter.getLocText("ComboCheckBox-Start_Symbol") + ":"), BorderLayout.WEST);
startPane.add(startComboBox = new DictionaryComboBox(DictionaryConstants.symbols, DictionaryConstants.symbolDisplays), BorderLayout.CENTER); startPane.add(startComboBox = new DictionaryComboBox(DictionaryConstants.symbols, DictionaryConstants.symbolDisplays), BorderLayout.CENTER);
startComboBox.setEditable(true); startComboBox.setEditable(true);
this.add(startPane);
endPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); endPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
endPane.add(new UILabel(Inter.getLocText("ComboCheckBox-End_Symbol") + ":"), BorderLayout.WEST); endPane.add(new UILabel(Inter.getLocText("ComboCheckBox-End_Symbol") + ":"), BorderLayout.WEST);
endPane.add(endComboBox = new DictionaryComboBox(DictionaryConstants.symbols, DictionaryConstants.symbolDisplays), BorderLayout.CENTER); endPane.add(endComboBox = new DictionaryComboBox(DictionaryConstants.symbols, DictionaryConstants.symbolDisplays), BorderLayout.CENTER);
endComboBox.setEditable(true); endComboBox.setEditable(true);
this.add(endPane); returnTypeComboBox = new UIButtonGroup(new String[]{Inter.getLocText("Widget-Array"), Inter.getLocText("String")});
returnTypePane.add(returnTypeComboBox, BorderLayout.CENTER);
returnTypeComboBox.addActionListener(new ActionListener(){ JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type") + ":"), returnTypePane}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
public void actionPerformed(ActionEvent e) { this.add(jPanel);
checkVisible();
}
});
} }
private void checkVisible(){ private void checkVisible(int selectIndex){
delimiterPane.setVisible(returnTypeComboBox.getSelectedIndex() == 1); delimiterPane.setVisible(selectIndex == 1);
startPane.setVisible(returnTypeComboBox.getSelectedIndex() == 1); startPane.setVisible(selectIndex == 1);
endPane.setVisible(returnTypeComboBox.getSelectedIndex() == 1); endPane.setVisible(selectIndex == 1);
} }
public void populate(ComboCheckBox comboCheckBox) { public void populate(ComboCheckBox comboCheckBox) {
@ -70,7 +60,7 @@ public class CheckBoxDictPane extends JPanel {
this.returnTypeComboBox.setSelectedIndex(comboCheckBox.isReturnString() ? 1 : 0); this.returnTypeComboBox.setSelectedIndex(comboCheckBox.isReturnString() ? 1 : 0);
this.startComboBox.setSelectedItem(comboCheckBox.getStartSymbol()); this.startComboBox.setSelectedItem(comboCheckBox.getStartSymbol());
this.endComboBox.setSelectedItem(comboCheckBox.getEndSymbol()); this.endComboBox.setSelectedItem(comboCheckBox.getEndSymbol());
checkVisible(); checkVisible(this.returnTypeComboBox.getSelectedIndex());
} }
public void update(ComboCheckBox comboCheckBox) { public void update(ComboCheckBox comboCheckBox) {
comboCheckBox.setDelimiter((String)this.delimiterComboBox.getSelectedItem()); comboCheckBox.setDelimiter((String)this.delimiterComboBox.getSelectedItem());
@ -83,7 +73,7 @@ public class CheckBoxDictPane extends JPanel {
this.returnTypeComboBox.setSelectedIndex(checkBoxGroup.isReturnString() ? 1 : 0); this.returnTypeComboBox.setSelectedIndex(checkBoxGroup.isReturnString() ? 1 : 0);
this.startComboBox.setSelectedItem(checkBoxGroup.getStartSymbol()); this.startComboBox.setSelectedItem(checkBoxGroup.getStartSymbol());
this.endComboBox.setSelectedItem(checkBoxGroup.getEndSymbol()); this.endComboBox.setSelectedItem(checkBoxGroup.getEndSymbol());
checkVisible(); checkVisible(this.returnTypeComboBox.getSelectedIndex());
} }
public void update(CheckBoxGroup checkBoxGroup) { public void update(CheckBoxGroup checkBoxGroup) {
checkBoxGroup.setDelimiter((String)this.delimiterComboBox.getSelectedItem()); checkBoxGroup.setDelimiter((String)this.delimiterComboBox.getSelectedItem());

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

@ -1,21 +1,18 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import java.awt.BorderLayout; import java.awt.*;
import java.awt.FlowLayout;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import com.fr.design.data.DataCreatorUI; import com.fr.design.data.DataCreatorUI;
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.present.dict.DictionaryPane; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.CheckBoxGroup; import com.fr.form.ui.CheckBoxGroup;
import com.fr.general.Inter; import com.fr.general.Inter;
public class CheckBoxGroupDefinePane extends FieldEditorDefinePane<CheckBoxGroup> { public class CheckBoxGroupDefinePane extends FieldEditorDefinePane<CheckBoxGroup> {
private DictionaryPane dictPane;
CheckBoxDictPane checkBoxDictPane; CheckBoxDictPane checkBoxDictPane;
private UICheckBox checkbox; private UICheckBox checkbox;
@ -29,7 +26,6 @@ public class CheckBoxGroupDefinePane extends FieldEditorDefinePane<CheckBoxGroup
protected void initComponents() { protected void initComponents() {
super.initComponents(); super.initComponents();
dictPane = new DictionaryPane();
} }
@Override @Override
@ -39,32 +35,31 @@ public class CheckBoxGroupDefinePane extends FieldEditorDefinePane<CheckBoxGroup
@Override @Override
protected JPanel setFirstContentPane() { protected JPanel setFirstContentPane() {
JPanel attrPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel advancePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
attrPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
northPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
checkBoxDictPane = new CheckBoxDictPane();
checkBoxDictPane.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0));
northPane.add(checkBoxDictPane, BorderLayout.NORTH);
JPanel chooseAllPane = new JPanel();
checkbox = new UICheckBox(Inter.getLocText(new String[]{"Provide", "Choose_All"})); checkbox = new UICheckBox(Inter.getLocText(new String[]{"Provide", "Choose_All"}));
chooseAllPane.add(checkbox); checkbox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
chooseAllPane.setLayout(new FlowLayout(FlowLayout.LEFT, 8, 0));
northPane.add(chooseAllPane, BorderLayout.CENTER);
attrPane.add(northPane, BorderLayout.NORTH);
JPanel centerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
buttonGroupDictPane = new ButtonGroupDictPane(); buttonGroupDictPane = new ButtonGroupDictPane();
buttonGroupDictPane.setLayout(new FlowLayout(FlowLayout.LEFT, 3, 0)); checkBoxDictPane = new CheckBoxDictPane();
centerPane.add(buttonGroupDictPane); double f = TableLayout.FILL;
attrPane.add(centerPane, BorderLayout.CENTER); double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{buttonGroupDictPane, null },
new Component[]{checkbox, null },
new Component[]{checkBoxDictPane, null },
};
double[] rowSize = {p, p, p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1},{1, 1},{1,1},{1,1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
// panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
advancePane.add(panel);
return advancePane;
return attrPane;
} }
@Override @Override
protected void populateSubFieldEditorBean(CheckBoxGroup ob) { protected void populateSubFieldEditorBean(CheckBoxGroup ob) {
this.dictPane.populateBean(ob.getDictionary());
checkBoxDictPane.populate(ob); checkBoxDictPane.populate(ob);
checkbox.setSelected(ob.isChooseAll()); checkbox.setSelected(ob.isChooseAll());
this.buttonGroupDictPane.populate(ob); this.buttonGroupDictPane.populate(ob);
@ -73,8 +68,6 @@ public class CheckBoxGroupDefinePane extends FieldEditorDefinePane<CheckBoxGroup
@Override @Override
protected CheckBoxGroup updateSubFieldEditorBean() { protected CheckBoxGroup updateSubFieldEditorBean() {
CheckBoxGroup ob = new CheckBoxGroup(); CheckBoxGroup ob = new CheckBoxGroup();
ob.setDictionary(this.dictPane.updateBean());
checkBoxDictPane.update(ob); checkBoxDictPane.update(ob);
ob.setChooseAll(checkbox.isSelected()); ob.setChooseAll(checkbox.isSelected());
this.buttonGroupDictPane.update(ob); this.buttonGroupDictPane.update(ob);
@ -83,6 +76,6 @@ public class CheckBoxGroupDefinePane extends FieldEditorDefinePane<CheckBoxGroup
@Override @Override
public DataCreatorUI dataUI() { public DataCreatorUI dataUI() {
return dictPane; return null;
} }
} }

24
designer/src/com/fr/design/widget/ui/ComboBoxDefinePane.java

@ -1,13 +1,19 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import javax.swing.JPanel; import javax.swing.*;
import com.fr.data.Dictionary;
import com.fr.design.data.DataCreatorUI; import com.fr.design.data.DataCreatorUI;
import com.fr.design.present.dict.DictionaryPane; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.accessibles.AccessibleDictionaryEditor;
import com.fr.form.ui.ComboBox; import com.fr.form.ui.ComboBox;
import com.fr.general.Inter;
import java.awt.*;
public class ComboBoxDefinePane extends CustomWritableRepeatEditorPane<ComboBox> { public class ComboBoxDefinePane extends CustomWritableRepeatEditorPane<ComboBox> {
protected DictionaryPane dictPane; protected AccessibleDictionaryEditor dictPane;
public ComboBoxDefinePane() { public ComboBoxDefinePane() {
this.initComponents(); this.initComponents();
@ -16,20 +22,22 @@ public class ComboBoxDefinePane extends CustomWritableRepeatEditorPane<ComboBox>
@Override @Override
protected void initComponents() { protected void initComponents() {
super.initComponents(); super.initComponents();
dictPane = new DictionaryPane();
} }
protected JPanel setForthContentPane () { protected JPanel setForthContentPane () {
return null; dictPane = new AccessibleDictionaryEditor();
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_DS-Dictionary")), dictPane}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
jPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
return jPanel;
} }
protected void populateSubCustomWritableRepeatEditorBean(ComboBox e) { protected void populateSubCustomWritableRepeatEditorBean(ComboBox e) {
this.dictPane.populateBean(e.getDictionary()); this.dictPane.setValue(e.getDictionary());
} }
protected ComboBox updateSubCustomWritableRepeatEditorBean() { protected ComboBox updateSubCustomWritableRepeatEditorBean() {
ComboBox combo = new ComboBox(); ComboBox combo = new ComboBox();
combo.setDictionary(this.dictPane.updateBean()); combo.setDictionary((Dictionary) this.dictPane.getValue());
return combo; return combo;
} }
@ -41,6 +49,6 @@ public class ComboBoxDefinePane extends CustomWritableRepeatEditorPane<ComboBox>
@Override @Override
public DataCreatorUI dataUI() { public DataCreatorUI dataUI() {
return dictPane; return null;
} }
} }

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

@ -1,9 +1,13 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import com.fr.data.Dictionary;
import com.fr.design.data.DataCreatorUI; import com.fr.design.data.DataCreatorUI;
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.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.present.dict.DictionaryPane; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.accessibles.AccessibleDictionaryEditor;
import com.fr.form.ui.ComboCheckBox; import com.fr.form.ui.ComboCheckBox;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -12,36 +16,40 @@ import java.awt.*;
public class ComboCheckBoxDefinePane extends CustomWritableRepeatEditorPane<ComboCheckBox> { public class ComboCheckBoxDefinePane extends CustomWritableRepeatEditorPane<ComboCheckBox> {
private CheckBoxDictPane checkBoxDictPane; private CheckBoxDictPane checkBoxDictPane;
private DictionaryPane dictPane; private AccessibleDictionaryEditor dictPane;
private UICheckBox supportTagCheckBox; private UICheckBox supportTagCheckBox;
public ComboCheckBoxDefinePane() { public ComboCheckBoxDefinePane() {
super.initComponents(); super.initComponents();
dictPane = new DictionaryPane();
} }
@Override @Override
protected JPanel setForthContentPane() { protected JPanel setForthContentPane() {
JPanel attrPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); dictPane = new AccessibleDictionaryEditor();
attrPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); checkBoxDictPane = new CheckBoxDictPane();
JPanel contenter = FRGUIPaneFactory.createBorderLayout_L_Pane(); supportTagCheckBox = new UICheckBox(Inter.getLocText("Form-SupportTag"), true);
contenter.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); supportTagCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
JPanel advancePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{supportTagCheckBox, null },
new Component[]{new UILabel(Inter.getLocText("FR-Designer_DS-Dictionary")), dictPane },
new Component[]{checkBoxDictPane, null },
checkBoxDictPane = new CheckBoxDictPane(); };
attrPane.add(contenter); double[] rowSize = {p, p, p, p};
//是否以标签形式显示 double[] columnSize = {p, f};
JPanel tagPane = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane(); int[][] rowCount = {{1, 1},{1, 1},{1,1},{1,1}};
supportTagCheckBox = new UICheckBox(Inter.getLocText("Form-SupportTag"), true); JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
tagPane.add(supportTagCheckBox); panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
contenter.add(tagPane, BorderLayout.NORTH); advancePane.add(panel);
return advancePane;
contenter.add(checkBoxDictPane, BorderLayout.WEST);
return attrPane;
} }
@Override @Override
protected void populateSubCustomWritableRepeatEditorBean(ComboCheckBox e) { protected void populateSubCustomWritableRepeatEditorBean(ComboCheckBox e) {
this.dictPane.populateBean(e.getDictionary()); this.dictPane.setValue(e.getDictionary());
this.checkBoxDictPane.populate(e); this.checkBoxDictPane.populate(e);
this.supportTagCheckBox.setSelected(e.isSupportTag()); this.supportTagCheckBox.setSelected(e.isSupportTag());
} }
@ -50,14 +58,14 @@ public class ComboCheckBoxDefinePane extends CustomWritableRepeatEditorPane<Comb
protected ComboCheckBox updateSubCustomWritableRepeatEditorBean() { protected ComboCheckBox updateSubCustomWritableRepeatEditorBean() {
ComboCheckBox combo = new ComboCheckBox(); ComboCheckBox combo = new ComboCheckBox();
combo.setSupportTag(this.supportTagCheckBox.isSelected()); combo.setSupportTag(this.supportTagCheckBox.isSelected());
combo.setDictionary(this.dictPane.updateBean()); combo.setDictionary((Dictionary) this.dictPane.getValue());
checkBoxDictPane.update(combo); checkBoxDictPane.update(combo);
return combo; return combo;
} }
@Override @Override
public DataCreatorUI dataUI() { public DataCreatorUI dataUI() {
return dictPane; return null;
} }
@Override @Override

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

@ -1 +1,66 @@
package com.fr.design.widget.ui; import com.fr.base.GraphHelper; 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; private static final int CUSTOM_DATA_CHECK_BOX_WIDTH = GraphHelper.getLocTextWidth("Form-Allow_CustomData") + 30; private static final int CUSTOM_DATA_CHECK_BOX_HEIGHT = 30; 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(CUSTOM_DATA_CHECK_BOX_WIDTH, CUSTOM_DATA_CHECK_BOX_HEIGHT)); JPanel otherContentPane = this.setForthContentPane(); if (otherContentPane != null) { contentPane.add(otherContentPane,BorderLayout.CENTER); } return contentPane; } public JPanel setValidatePane(){ JPanel otherContentPane = super.setValidatePane(); otherContentPane.add(GUICoreUtils.createFlowPane(new JComponent[]{customDataCheckBox}, FlowLayout.LEFT, 5)); return otherContentPane; } 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.base.GraphHelper;
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;
private static final int CUSTOM_DATA_CHECK_BOX_WIDTH = GraphHelper.getLocTextWidth("Form-Allow_CustomData") + 30;
private static final int CUSTOM_DATA_CHECK_BOX_HEIGHT = 30;
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(CUSTOM_DATA_CHECK_BOX_WIDTH, CUSTOM_DATA_CHECK_BOX_HEIGHT));
this.customDataCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
JPanel otherContentPane = this.setForthContentPane();
return otherContentPane;
}
public JPanel setValidatePane(){
JPanel otherContentPane = super.setValidatePane();
JPanel jPanel = GUICoreUtils.createFlowPane(new JComponent[]{customDataCheckBox}, FlowLayout.LEFT, 0);
otherContentPane.add(jPanel, BorderLayout.CENTER);
return otherContentPane;
}
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();
}

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

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

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

@ -12,7 +12,7 @@ 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> {
public UICheckBox directWriteCheckBox; public UICheckBox directWriteCheckBox;
private WaterMarkDictPane waterMarkDictPane; protected WaterMarkDictPane waterMarkDictPane;
public DirectWriteEditorDefinePane() { public DirectWriteEditorDefinePane() {
this.initComponents(); this.initComponents();
@ -21,16 +21,16 @@ public abstract class DirectWriteEditorDefinePane<T extends DirectWriteEditor> e
@Override @Override
protected JPanel setFirstContentPane() { protected JPanel setFirstContentPane() {
JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
contentPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); contentPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
directWriteCheckBox = new UICheckBox(Inter.getLocText("Form-Allow_Edit"), false); directWriteCheckBox = new UICheckBox(Inter.getLocText("Form-Allow_Edit"), false);
directWriteCheckBox.setPreferredSize(new Dimension(100, 30)); directWriteCheckBox.setPreferredSize(new Dimension(100, 30));
waterMarkDictPane = new WaterMarkDictPane(); waterMarkDictPane = new WaterMarkDictPane();
contentPane.add(waterMarkDictPane); contentPane.add(waterMarkDictPane, BorderLayout.NORTH);
JPanel otherContentPane = this.setSecondContentPane(); JPanel otherContentPane = this.setSecondContentPane();
if (otherContentPane != null) { if (otherContentPane != null) {
contentPane.add(otherContentPane); contentPane.add(otherContentPane, BorderLayout.CENTER);
} }
return contentPane; return contentPane;
} }
@ -38,8 +38,9 @@ public abstract class DirectWriteEditorDefinePane<T extends DirectWriteEditor> e
public JPanel setValidatePane(){ public JPanel setValidatePane(){
JPanel otherContentPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel otherContentPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
otherContentPane.add(GUICoreUtils.createFlowPane(new JComponent[]{directWriteCheckBox}, FlowLayout.LEFT, 5)); JPanel jPanel = GUICoreUtils.createFlowPane(new JComponent[]{directWriteCheckBox}, FlowLayout.LEFT, 0);
otherContentPane.add(jPanel, BorderLayout.NORTH);
return otherContentPane; return otherContentPane;
} }

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

@ -68,7 +68,6 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
@Override @Override
public void populateBean(T ob) { public void populateBean(T ob) {
this.allowBlankCheckBox.setSelected(ob.isAllowBlank()); this.allowBlankCheckBox.setSelected(ob.isAllowBlank());
// errorMsgTextField.setEnabled(!allowBlankCheckBox.isSelected());
this.errorMsgTextField.setText(ob.getErrorMessage()); this.errorMsgTextField.setText(ob.getErrorMessage());
populateSubFieldEditorBean(ob); populateSubFieldEditorBean(ob);
@ -101,7 +100,7 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
final UILabel uiLabel = new UILabel(Inter.getLocText(new String[]{"FR-Designer_Error", "FR-Designer_Tooltips"})); final UILabel uiLabel = new UILabel(Inter.getLocText(new String[]{"FR-Designer_Error", "FR-Designer_Tooltips"}));
errorMsgTextField = new UITextField(10); errorMsgTextField = new UITextField(10);
allowBlankCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Allow_Null")); allowBlankCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Allow_Null"));
allowBlankCheckBox.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5)); allowBlankCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
allowBlankCheckBox.setPreferredSize(new Dimension(ALLOW_BLANK_CHECK_BOX_WIDTH, ALLOW_BLANK_CHECK_BOX_HEIGHT)); allowBlankCheckBox.setPreferredSize(new Dimension(ALLOW_BLANK_CHECK_BOX_WIDTH, ALLOW_BLANK_CHECK_BOX_HEIGHT));
allowBlankCheckBox.addItemListener(new ItemListener() { allowBlankCheckBox.addItemListener(new ItemListener() {
@ -141,15 +140,6 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Validate"), 280, 24, validatePane); UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Validate"), 280, 24, validatePane);
this.add(uiExpandablePane, BorderLayout.CENTER); this.add(uiExpandablePane, BorderLayout.CENTER);
// JPanel firstPane = GUICoreUtils.createFlowPane(new JComponent[]{allowBlankCheckBox}, FlowLayout.LEFT, 5);
// validatePane.add(firstPane);
// JPanel secondPane = new JPanel(FRGUIPaneFactory.createLabelFlowLayout());
// secondPane.add(new UILabel("错误提示" + ":"));
// secondPane.add(errorMsgTextField);
// JPanel secondPane = GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"), errorMsgTextField}, FlowLayout.LEFT, 24);
// secondPane.setPreferredSize(new Dimension(400, 23));
// validatePane.add(secondPane);
} }
public JPanel setValidatePane() { public JPanel setValidatePane() {

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

@ -1,17 +1,14 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import java.awt.*; import com.fr.base.FRContext;
import java.util.List;
import javax.swing.BorderFactory;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.dialog.DialogActionListener;
import com.fr.design.dialog.UIDialog;
import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import com.fr.design.gui.frpane.ReportletParameterViewPane; import com.fr.design.gui.frpane.ReportletParameterViewPane;
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.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
@ -20,68 +17,114 @@ 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;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
public class IframeEditorDefinePane extends AbstractDataModify<IframeEditor> { public class IframeEditorDefinePane extends AbstractDataModify<IframeEditor> {
private UITextField srcTextField;
private ReportletParameterViewPane parameterViewPane; private static final int P_W = 610;
private UICheckBox horizontalCheck; private static final int P_H = 580;
private UICheckBox verticalCheck; private UITextField srcTextField;
private ReportletParameterViewPane parameterViewPane;
public IframeEditorDefinePane() { private UICheckBox horizontalCheck;
this.initComponents(); private UICheckBox verticalCheck;
} private UIButton parameterViewPaneButton;
private List<ParameterProvider> list;
private void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); public IframeEditorDefinePane() {
JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); this.initComponents();
contentPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); }
JPanel attr = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane();
attr.add(horizontalCheck = new UICheckBox(Inter.getLocText("Preference-Horizontal_Scroll_Bar_Visible"))); private void initComponents() {
attr.add(verticalCheck = new UICheckBox(Inter.getLocText("Preference-Vertical_Scroll_Bar_Visible"))); this.setLayout(FRGUIPaneFactory.createBorderLayout());
contentPane.add(attr); this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
double p = TableLayout.PREFERRED; JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
double f = TableLayout.FILL; contentPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
double[] rowSize = { p, p, p, p }; JPanel attr = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane();
double[] columnSize = { p, f }; attr.add(horizontalCheck = new UICheckBox(Inter.getLocText("Preference-Horizontal_Scroll_Bar_Visible")));
attr.add(verticalCheck = new UICheckBox(Inter.getLocText("Preference-Vertical_Scroll_Bar_Visible")));
java.awt.Component[][] coms = { contentPane.add(attr);
{ horizontalCheck, null }, double p = TableLayout.PREFERRED;
{ verticalCheck, null }, double f = TableLayout.FILL;
{ new UILabel(Inter.getLocText("Form-Url") + ":"), srcTextField = new UITextField() }, double[] rowSize = {p, p, p, p};
{ new UILabel(Inter.getLocText("Parameter") + ":"), parameterViewPane = new ReportletParameterViewPane() } }; double[] columnSize = {p, f};
int[][] rowCount = {{1, 1},{1, 1},{1, 1}, {1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(coms, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, 5); parameterViewPaneButton = new UIButton(Inter.getLocText("FR-Designer_Edit"));
parameterViewPaneButton.addActionListener(parameterListener);
parameterViewPane = new ReportletParameterViewPane();
contentPane.add(panel);
java.awt.Component[][] coms = {
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, contentPane); {horizontalCheck, null},
this.add(uiExpandablePane, BorderLayout.NORTH); {verticalCheck, null},
{new UILabel(Inter.getLocText("Form-Url")), srcTextField = new UITextField()},
} {new UILabel(Inter.getLocText("FR-Designer_Parameters")), parameterViewPaneButton}};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(coms, rowSize, columnSize, rowCount, 45, LayoutConstants.VGAP_LARGE);
@Override
protected String title4PopupWindow() {
return "iframe"; contentPane.add(panel);
}
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 24, contentPane);
@Override this.add(uiExpandablePane, BorderLayout.NORTH);
public void populateBean(IframeEditor e) {
srcTextField.setText(e.getSrc()); }
parameterViewPane.populate(e.getParameters());
this.horizontalCheck.setSelected(e.isOverflowx()); ActionListener parameterListener = new ActionListener() {
this.verticalCheck.setSelected(e.isOverflowy()); @Override
} public void actionPerformed(ActionEvent e) {
List<ParameterProvider> paraList = parameterViewPane.update();
@Override list = new ArrayList<ParameterProvider>();
public IframeEditor updateBean() { ParameterProvider pr = null;
IframeEditor ob = new IframeEditor(); for (ParameterProvider parameterProvider : paraList) {
ob.setSrc(srcTextField.getText()); try {
List<ParameterProvider> parameterList = parameterViewPane.update(); pr = (ParameterProvider) parameterProvider.clone();
ob.setParameters(parameterList.toArray(new ParameterProvider[parameterList.size()])); } catch (CloneNotSupportedException e1) {
ob.setOverflowx(this.horizontalCheck.isSelected()); FRContext.getLogger().error(e1.getMessage(), e1);
ob.setOverflowy(this.verticalCheck.isSelected()); }
return ob; list.add(pr);
} }
UIDialog dialog = parameterViewPane.showUnsizedWindow(SwingUtilities.getWindowAncestor(new JPanel()), new DialogActionListener() {
@Override
public void doOk() {
}
@Override
public void doCancel() {
parameterViewPane.update(list);
}
});
dialog.setSize(P_W, P_H);
dialog.setVisible(true);
}
};
@Override
protected String title4PopupWindow() {
return "iframe";
}
@Override
public void populateBean(IframeEditor e) {
srcTextField.setText(e.getSrc());
parameterViewPane.populate(e.getParameters());
this.horizontalCheck.setSelected(e.isOverflowx());
this.verticalCheck.setSelected(e.isOverflowy());
}
@Override
public IframeEditor updateBean() {
IframeEditor ob = new IframeEditor();
ob.setSrc(srcTextField.getText());
List<ParameterProvider> parameterList = parameterViewPane.update();
ob.setParameters(parameterList.toArray(new ParameterProvider[parameterList.size()]));
ob.setOverflowx(this.horizontalCheck.isSelected());
ob.setOverflowy(this.verticalCheck.isSelected());
return ob;
}
} }

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

@ -1,17 +1,21 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import javax.swing.JPanel; import javax.swing.*;
import com.fr.data.Dictionary;
import com.fr.design.data.DataCreatorUI; import com.fr.design.data.DataCreatorUI;
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.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.present.dict.DictionaryPane; import com.fr.design.mainframe.widget.accessibles.AccessibleDictionaryEditor;
import com.fr.form.ui.ListEditor; import com.fr.form.ui.ListEditor;
import com.fr.general.Inter; import com.fr.general.Inter;
import java.awt.*;
public class ListEditorDefinePane extends WriteUnableRepeatEditorPane<ListEditor> { public class ListEditorDefinePane extends WriteUnableRepeatEditorPane<ListEditor> {
private UICheckBox needHeadCheckBox; private UICheckBox needHeadCheckBox;
private DictionaryPane dictPane; private AccessibleDictionaryEditor dictPane;
public ListEditorDefinePane() { public ListEditorDefinePane() {
this.initComponents(); this.initComponents();
@ -20,14 +24,20 @@ public class ListEditorDefinePane extends WriteUnableRepeatEditorPane<ListEditor
@Override @Override
protected void initComponents() { protected void initComponents() {
super.initComponents(); super.initComponents();
dictPane = new DictionaryPane();
} }
protected Component[] createDicPane(){
dictPane = new AccessibleDictionaryEditor();
return new Component[]{new UILabel(Inter.getLocText("FR-Designer_DS-Dictionary")), dictPane};
}
@Override @Override
protected JPanel setThirdContentPane() { protected JPanel setThirdContentPane() {
JPanel contenter = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel contenter = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane_First0();
JPanel centerPane = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane(); JPanel centerPane = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane_First0();
centerPane.add(needHeadCheckBox = new UICheckBox(Inter.getLocText("List-Need_Head"))); centerPane.add(needHeadCheckBox = new UICheckBox(Inter.getLocText("List-Need_Head")));
needHeadCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
contenter.add(centerPane); contenter.add(centerPane);
return contenter; return contenter;
} }
@ -40,7 +50,7 @@ public class ListEditorDefinePane extends WriteUnableRepeatEditorPane<ListEditor
@Override @Override
protected void populateSubWriteUnableRepeatBean(ListEditor e) { protected void populateSubWriteUnableRepeatBean(ListEditor e) {
needHeadCheckBox.setSelected(e.isNeedHead()); needHeadCheckBox.setSelected(e.isNeedHead());
this.dictPane.populateBean(e.getDictionary()); this.dictPane.setValue(e.getDictionary());
} }
@Override @Override
@ -48,13 +58,13 @@ public class ListEditorDefinePane extends WriteUnableRepeatEditorPane<ListEditor
ListEditor ob = new ListEditor(); ListEditor ob = new ListEditor();
ob.setNeedHead(needHeadCheckBox.isSelected()); ob.setNeedHead(needHeadCheckBox.isSelected());
ob.setDictionary(this.dictPane.updateBean()); ob.setDictionary((Dictionary) this.dictPane.getValue());
return ob; return ob;
} }
@Override @Override
public DataCreatorUI dataUI() { public DataCreatorUI dataUI() {
return dictPane; return null;
} }
} }

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

@ -1,92 +1,83 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import java.awt.*;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.ilable.UILabel;
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.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.gui.ispinner.UISpinner;
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.form.ui.MultiFileEditor; import com.fr.form.ui.MultiFileEditor;
import com.fr.general.Inter; import com.fr.general.Inter;
public class MultiFileEditorPane extends FieldEditorDefinePane<MultiFileEditor> { import javax.swing.*;
private DictionaryComboBox acceptType; import java.awt.*;
private UICheckBox singleFileCheckBox;
private UINumberField fileSizeField;
public MultiFileEditorPane() {
this.initComponents();
}
@Override
protected String title4PopupWindow() {
return "file";
}
@Override
protected JPanel setFirstContentPane() {
acceptType = new DictionaryComboBox(DictionaryConstants.acceptTypes, DictionaryConstants.fileTypeDisplays);
acceptType.setPreferredSize(new Dimension(200, 18));
singleFileCheckBox = new UICheckBox(Inter.getLocText("SINGLE_FILE_UPLOAD"));
fileSizeField = new UINumberField();
fileSizeField.setPreferredSize(new Dimension(80, 18));
JPanel singleFilePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane();
singleFilePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
singleFilePane.add(singleFileCheckBox);
JPanel allowTypePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane();
allowTypePane.setLayout(FRGUIPaneFactory.createLabelFlowLayout());
allowTypePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
allowTypePane.add(new UILabel(" " + Inter.getLocText("File-Allow_Upload_Files") + ":"));
allowTypePane.add(acceptType);
JPanel fileSizePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane();
fileSizePane.add(new UILabel(" " + Inter.getLocText("File-File_Size_Limit") + ":"));
fileSizePane.add(fileSizeField);
fileSizePane.add(new UILabel(" KB"));
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{singleFileCheckBox, null },
new Component[]{new UILabel(" " + Inter.getLocText("File-Allow_Upload_Files") + ":"), acceptType},
new Component[]{new UILabel(" " + Inter.getLocText("File-File_Size_Limit") + ":"), fileSizeField},
};
double[] rowSize = {p, p,p};
double[] columnSize = {p,f};
int[][] rowCount = {{1, 1},{1, 1},{1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, 5);
return panel;
}
@Override
protected void populateSubFieldEditorBean(MultiFileEditor e) {
// 这里存在兼容问题 getAccept可能没在待选项目中
acceptType.setSelectedItem(e.getAccept());
singleFileCheckBox.setSelected(e.isSingleFile());
fileSizeField.setValue(e.getMaxSize());
}
@Override public class MultiFileEditorPane extends FieldEditorDefinePane<MultiFileEditor> {
protected MultiFileEditor updateSubFieldEditorBean() { private DictionaryComboBox acceptType;
MultiFileEditor ob = new MultiFileEditor(); private UICheckBox singleFileCheckBox;
ob.setAccept((String) acceptType.getSelectedItem()); private UISpinner fileSizeField;
ob.setSingleFile(singleFileCheckBox.isSelected());
ob.setMaxSize(fileSizeField.getValue()); public MultiFileEditorPane() {
return ob; this.initComponents();
} }
@Override
protected String title4PopupWindow() {
return "file";
}
@Override
protected JPanel setFirstContentPane() {
JPanel contenter = new JPanel(new BorderLayout());
singleFileCheckBox = new UICheckBox(Inter.getLocText("SINGLE_FILE_UPLOAD"));
singleFileCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
acceptType = new DictionaryComboBox(DictionaryConstants.acceptTypes, DictionaryConstants.fileTypeDisplays);
// acceptType.setPreferredSize(new Dimension(100, 20));
fileSizeField = new UISpinner(0, Integer.MAX_VALUE, 1, -1);
fileSizeField.setPreferredSize(new Dimension(140, 20));
JPanel fileSizePane = new JPanel(new BorderLayout());
UILabel fileTypeLabel = new UILabel(Inter.getLocText("Utils-File_type"));
UILabel fileSizeLabel = new UILabel(Inter.getLocText("FR-Designer_Size_Limit"));
fileSizePane.add(fileSizeField, BorderLayout.CENTER);
fileSizePane.add(new UILabel(" KB"), BorderLayout.EAST);
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{singleFileCheckBox, null},
new Component[]{fileTypeLabel, acceptType},
new Component[]{fileSizeLabel, fileSizePane},
};
double[] rowSize = {p, p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 22, 10);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 00));
contenter.add(panel, BorderLayout.CENTER);
return contenter;
}
@Override
protected void populateSubFieldEditorBean(MultiFileEditor e) {
// 这里存在兼容问题 getAccept可能没在待选项目中
acceptType.setSelectedItem(e.getAccept());
singleFileCheckBox.setSelected(e.isSingleFile());
fileSizeField.setValue(e.getMaxSize());
}
@Override
protected MultiFileEditor updateSubFieldEditorBean() {
MultiFileEditor ob = new MultiFileEditor();
ob.setAccept((String) acceptType.getSelectedItem());
ob.setSingleFile(singleFileCheckBox.isSelected());
ob.setMaxSize(fileSizeField.getValue());
return ob;
}
} }

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

@ -4,10 +4,12 @@ import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JFormattedTextField; import javax.swing.JFormattedTextField;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -26,7 +28,7 @@ import com.fr.general.Inter;
public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor> { public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor> {
/** /**
* * FieldEditorDefinePane
*/ */
private static final long serialVersionUID = 8011242951911686805L; private static final long serialVersionUID = 8011242951911686805L;
private UICheckBox allowDecimalsCheckBox; private UICheckBox allowDecimalsCheckBox;
@ -37,7 +39,7 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
private SpinnerNumberModel maxValueModel; private SpinnerNumberModel maxValueModel;
private UIBasicSpinner minValueSpinner; private UIBasicSpinner minValueSpinner;
private SpinnerNumberModel minValueModel; private SpinnerNumberModel minValueModel;
private com.fr.design.editor.editor.IntegerEditor decimalLength; private UIBasicSpinner decimalLength;
private JPanel limitNumberPane; private JPanel limitNumberPane;
private WaterMarkDictPane waterMarkDictPane; private WaterMarkDictPane waterMarkDictPane;
@ -78,7 +80,7 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
}; };
private ActionListener actionListener3 = new ActionListener() { public ActionListener actionListener3 = new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (setMaxValueCheckBox.isSelected()) { if (setMaxValueCheckBox.isSelected()) {
maxValueSpinner.setVisible(true); maxValueSpinner.setVisible(true);
@ -142,7 +144,8 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
}; };
public NumberEditorDefinePane() { public NumberEditorDefinePane() {
super(); // super();
this.initComponents();
} }
@ -153,59 +156,76 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
@Override @Override
protected JPanel setFirstContentPane() { protected JPanel setFirstContentPane() {
JPanel content = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); JPanel content = FRGUIPaneFactory.createBorderLayout_S_Pane();
content.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
content.setLayout(FRGUIPaneFactory.createBorderLayout());
// richer:数字的允许直接编辑没有意义
waterMarkDictPane = new WaterMarkDictPane(); waterMarkDictPane = new WaterMarkDictPane();
waterMarkDictPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
content.add(waterMarkDictPane, BorderLayout.CENTER);
return content;
return waterMarkDictPane;
} }
public JPanel setValidatePane() { public JPanel setValidatePane() {
this.allowDecimalsCheckBox = new UICheckBox(Inter.getLocText("Allow_Decimals")); this.allowDecimalsCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Allow_Decimals"));
this.decimalLength = new com.fr.design.editor.editor.IntegerEditor(); allowDecimalsCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
this.decimalLength.setColumns(4); this.decimalLength = new UIBasicSpinner(new SpinnerNumberModel(16, 0, Integer.MAX_VALUE, 1));
this.decimalLength.setPreferredSize(new Dimension(155, 20));
this.allowDecimalsCheckBox.addActionListener(actionListener1); this.allowDecimalsCheckBox.addActionListener(actionListener1);
this.allowNegativeCheckBox = new UICheckBox(Inter.getLocText("Allow_Negative")); this.allowNegativeCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Allow_Negative"));
this.allowNegativeCheckBox.addActionListener(actionListener2); this.allowNegativeCheckBox.addActionListener(actionListener2);
allowNegativeCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
this.setMaxValueCheckBox = new UICheckBox(Inter.getLocText("Need_Max_Value"), false); this.setMaxValueCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Max_Value"), false);
setMaxValueCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
this.maxValueSpinner = new UIBasicSpinner(maxValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D)); this.maxValueSpinner = new UIBasicSpinner(maxValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D));
maxValueSpinner.setPreferredSize(new Dimension(120, 20)); maxValueSpinner.setPreferredSize(new Dimension(155, 20));
setNotAllowsInvalid(this.maxValueSpinner); setNotAllowsInvalid(this.maxValueSpinner);
this.maxValueSpinner.setVisible(false); this.maxValueSpinner.setVisible(false);
this.setMaxValueCheckBox.addActionListener(actionListener3); this.setMaxValueCheckBox.addActionListener(actionListener3);
this.maxValueSpinner.addChangeListener(changeListener1); this.maxValueSpinner.addChangeListener(changeListener1);
this.setMinValueCheckBox = new UICheckBox(Inter.getLocText("Need_Min_Value"), false); this.setMinValueCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Min_Value"), false);
setMinValueCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
this.minValueSpinner = new UIBasicSpinner(minValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D)); this.minValueSpinner = new UIBasicSpinner(minValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D));
minValueSpinner.setPreferredSize(new Dimension(120, 20)); minValueSpinner.setPreferredSize(new Dimension(155, 20));
setNotAllowsInvalid(this.minValueSpinner); setNotAllowsInvalid(this.minValueSpinner);
this.minValueSpinner.setVisible(false); this.minValueSpinner.setVisible(false);
this.setMinValueCheckBox.addActionListener(actionListener4); this.setMinValueCheckBox.addActionListener(actionListener4);
this.minValueSpinner.addChangeListener(changeListener2); this.minValueSpinner.addChangeListener(changeListener2);
UILabel numberLabel = new UILabel(Inter.getLocText(new String[]{"FR-Designer_Double", "Numbers"}));
numberLabel.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0));
JPanel decimalPane = new JPanel(new BorderLayout());
decimalPane.add(decimalLength, BorderLayout.CENTER);
decimalPane.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0));
JPanel maxValueSpinnerPane = new JPanel(new BorderLayout());
maxValueSpinnerPane.add(maxValueSpinner, BorderLayout.CENTER);
maxValueSpinnerPane.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0));
JPanel minValueSpinnerPane = new JPanel(new BorderLayout());
minValueSpinnerPane.add(minValueSpinner, BorderLayout.CENTER);
minValueSpinnerPane.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0));
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{allowDecimalsCheckBox, null }, new Component[]{allowDecimalsCheckBox, null},
new Component[]{new UILabel(Inter.getLocText(new String[]{"Double", "Numbers"})), decimalLength }, new Component[]{numberLabel, decimalPane},
new Component[]{allowNegativeCheckBox, null}, new Component[]{allowNegativeCheckBox, null},
new Component[]{setMaxValueCheckBox, maxValueSpinner}, new Component[]{setMaxValueCheckBox, maxValueSpinnerPane},
new Component[]{setMinValueCheckBox, minValueSpinner}, new Component[]{setMinValueCheckBox, minValueSpinnerPane},
}; };
double[] rowSize = {p, p, p, p, p}; double[] rowSize = {p, p, p, p, p};
double[] columnSize = {p,f}; double[] columnSize = {p, f};
int[][] rowCount = {{1, 1},{1, 1},{1, 1},{1, 1},{1, 1}}; int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 1); JPanel pane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
return panel; pane.setBorder(BorderFactory.createEmptyBorder(0, 1, 0, 0));
return pane;
} }
@ -250,7 +270,7 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
NumberEditor ob = new NumberEditor(); NumberEditor ob = new NumberEditor();
ob.setAllowDecimals(allowDecimalsCheckBox.isSelected()); ob.setAllowDecimals(allowDecimalsCheckBox.isSelected());
if (allowDecimalsCheckBox.isSelected()) { if (allowDecimalsCheckBox.isSelected()) {
ob.setMaxDecimalLength(this.decimalLength.getValue()); ob.setMaxDecimalLength((Integer) this.decimalLength.getValue());
} }
ob.setAllowNegative(allowNegativeCheckBox.isSelected()); ob.setAllowNegative(allowNegativeCheckBox.isSelected());

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

@ -1,16 +1,10 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import java.awt.FlowLayout;
import javax.swing.JPanel; import javax.swing.JPanel;
import com.fr.design.data.DataCreatorUI; import com.fr.design.data.DataCreatorUI;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.present.dict.DictionaryPane;
import com.fr.form.ui.RadioGroup; import com.fr.form.ui.RadioGroup;
public class RadioGroupDefinePane extends FieldEditorDefinePane<RadioGroup> { public class RadioGroupDefinePane extends FieldEditorDefinePane<RadioGroup> {
private DictionaryPane dictPane;
private ButtonGroupDictPane buttonGroupDictPane; private ButtonGroupDictPane buttonGroupDictPane;
@ -22,24 +16,18 @@ public class RadioGroupDefinePane extends FieldEditorDefinePane<RadioGroup> {
protected void initComponents() { protected void initComponents() {
super.initComponents(); super.initComponents();
dictPane = new DictionaryPane();
} }
@Override @Override
protected JPanel setFirstContentPane() { protected JPanel setFirstContentPane() {
JPanel centerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
buttonGroupDictPane = new ButtonGroupDictPane(); buttonGroupDictPane = new ButtonGroupDictPane();
buttonGroupDictPane.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); return buttonGroupDictPane;
centerPane.add(buttonGroupDictPane);
return centerPane;
} }
@Override @Override
protected RadioGroup updateSubFieldEditorBean() { protected RadioGroup updateSubFieldEditorBean() {
RadioGroup ob = new RadioGroup(); RadioGroup ob = new RadioGroup();
ob.setDictionary(this.dictPane.updateBean());
this.buttonGroupDictPane.update(ob); this.buttonGroupDictPane.update(ob);
return ob; return ob;
@ -52,12 +40,11 @@ public class RadioGroupDefinePane extends FieldEditorDefinePane<RadioGroup> {
@Override @Override
protected void populateSubFieldEditorBean(RadioGroup ob) { protected void populateSubFieldEditorBean(RadioGroup ob) {
this.dictPane.populateBean(ob.getDictionary());
this.buttonGroupDictPane.populate(ob); this.buttonGroupDictPane.populate(ob);
} }
@Override @Override
public DataCreatorUI dataUI() { public DataCreatorUI dataUI() {
return dictPane; return null;
} }
} }

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

@ -1,12 +1,14 @@
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.layout.FRGUIPaneFactory;
import com.fr.form.ui.TextEditor; import com.fr.form.ui.TextEditor;
import com.fr.form.ui.reg.RegExp; 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.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter; import java.awt.event.KeyAdapter;
@ -56,16 +58,18 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane<TextEditor>
} }
}); });
JPanel content = FRGUIPaneFactory.createBorderLayout_S_Pane();
waterMarkDictPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
content.add(waterMarkDictPane, BorderLayout.CENTER);
return waterMarkDictPane; return content;
} }
public JPanel setValidatePane(){ public JPanel setValidatePane() {
return regPane; return regPane;
} }
protected RegPane createRegPane() { protected RegPane createRegPane() {
return new RegPane(); return new RegPane();
} }

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

@ -46,13 +46,14 @@ public class TreeEditorDefinePane extends FieldEditorDefinePane<TreeEditor> {
@Override @Override
protected JPanel setFirstContentPane() { protected JPanel setFirstContentPane() {
return this.setSecondContentPane(); return this.setSecondContentPane();
} }
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(); JPanel contenter = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane_First0();
contentPane.add(contenter,BorderLayout.NORTH); contentPane.add(contenter,BorderLayout.NORTH);
removeRepeatCheckBox = new UICheckBox(Inter.getLocText("Form-Remove_Repeat_Data"), false); removeRepeatCheckBox = new UICheckBox(Inter.getLocText("Form-Remove_Repeat_Data"), false);
contenter.add(removeRepeatCheckBox); contenter.add(removeRepeatCheckBox);

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

@ -1,20 +1,16 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import java.awt.*;
import java.awt.event.KeyListener;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import javax.swing.*;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.WaterMark; import com.fr.form.ui.WaterMark;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
import java.awt.event.KeyListener;
public class WaterMarkDictPane extends JPanel { public class WaterMarkDictPane extends JPanel {
private UITextField waterMarkTextField; private UITextField waterMarkTextField;
@ -27,7 +23,7 @@ public class WaterMarkDictPane extends JPanel {
waterMarkTextField = new UITextField(13); waterMarkTextField = new UITextField(13);
UILabel emptyLabel = new UILabel(); UILabel emptyLabel = new UILabel();
emptyLabel.setBorder(BorderFactory.createEmptyBorder(0, 33, 0, 0)); emptyLabel.setBorder(BorderFactory.createEmptyBorder(0, 30, 0, 0));
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
@ -38,8 +34,7 @@ public class WaterMarkDictPane extends JPanel {
double[] columnSize = {p, p, f}; double[] columnSize = {p, p, f};
int[][] rowCount = {{1, 1}}; int[][] rowCount = {{1, 1}};
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
// JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM); panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 5, 0));
this.add(panel, BorderLayout.CENTER); this.add(panel, BorderLayout.CENTER);
} }

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

@ -15,7 +15,7 @@ public abstract class WritableRepeatEditorPane<E extends WriteAbleRepeatEditor>
@Override @Override
protected JPanel setSecondContentPane() { protected JPanel setSecondContentPane() {
JPanel contentPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
JPanel otherContentPane = this.setThirdContentPane(); JPanel otherContentPane = this.setThirdContentPane();
if (otherContentPane != null) { if (otherContentPane != null) {

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

@ -1,12 +1,14 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import java.awt.BorderLayout; import java.awt.*;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
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.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.WriteUnableRepeatEditor; import com.fr.form.ui.WriteUnableRepeatEditor;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -20,17 +22,35 @@ public abstract class WriteUnableRepeatEditorPane<E extends WriteUnableRepeatEdi
@Override @Override
protected JPanel setFirstContentPane() { protected JPanel setFirstContentPane() {
JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); JPanel contentPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
contentPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
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);
contentPane.add(contenter); removeRepeatCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
contenter.add(removeRepeatCheckBox);
Component[] dicPane = createDicPane();
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
dicPane,
new Component[]{removeRepeatCheckBox, null},
};
double[] rowSize = {p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1,1},{1,1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
contentPane.add(panel);
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 contentPane;
} }
protected Component[] createDicPane(){
return new Component[]{null, null};
}
protected abstract JPanel setThirdContentPane(); protected abstract JPanel setThirdContentPane();
@Override @Override
protected void populateSubFieldEditorBean(WriteUnableRepeatEditor e) { protected void populateSubFieldEditorBean(WriteUnableRepeatEditor e) {

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

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

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

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

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

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

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

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

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

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

7
designer/src/com/fr/grid/selection/CellSelection.java

@ -18,12 +18,14 @@ import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.imenu.UIMenu; import com.fr.design.gui.imenu.UIMenu;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.CellElementPropertyPane; import com.fr.design.mainframe.CellElementPropertyPane;
import com.fr.design.mainframe.CellWidgetPropertyPane;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.ElementCasePane.Clear; import com.fr.design.mainframe.ElementCasePane.Clear;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
import com.fr.design.report.RowColumnPane; import com.fr.design.report.RowColumnPane;
import com.fr.design.selection.QuickEditor; import com.fr.design.selection.QuickEditor;
import com.fr.form.ui.CellWidget;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.grid.GridUtils; import com.fr.grid.GridUtils;
import com.fr.report.cell.CellElement; import com.fr.report.cell.CellElement;
@ -687,4 +689,9 @@ public class CellSelection extends Selection {
public void populatePropertyPane(ElementCasePane ePane) { public void populatePropertyPane(ElementCasePane ePane) {
CellElementPropertyPane.getInstance().reInit(ePane); CellElementPropertyPane.getInstance().reInit(ePane);
} }
public void populateWidgetPropertyPane(ElementCasePane ePane){
CellWidgetPropertyPane.getInstance().reInit(ePane);
}
} }

5
designer/src/com/fr/grid/selection/FloatSelection.java

@ -234,4 +234,9 @@ public class FloatSelection extends Selection {
public void populatePropertyPane(ElementCasePane ePane) { public void populatePropertyPane(ElementCasePane ePane) {
CellElementPropertyPane.getInstance().removeAll(); CellElementPropertyPane.getInstance().removeAll();
} }
public void populateWidgetPropertyPane(ElementCasePane ePane){
return;
}
} }

2
designer/src/com/fr/grid/selection/Selection.java

@ -90,6 +90,8 @@ public abstract class Selection implements FCloneable, Serializable , Selectable
public abstract void populatePropertyPane(ElementCasePane ePane); public abstract void populatePropertyPane(ElementCasePane ePane);
public abstract void populateWidgetPropertyPane(ElementCasePane ePane);
@Override @Override
public Selection clone() throws CloneNotSupportedException { public Selection clone() throws CloneNotSupportedException {

229
designer/src/com/fr/quickeditor/CellQuickEditor.java

@ -1,70 +1,188 @@
package com.fr.quickeditor; package com.fr.quickeditor;
import com.fr.base.BaseUtils; import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.utils.DeprecatedActionManager; import com.fr.design.actions.core.ActionFactory;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.iscrollbar.UIScrollBar;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
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.mainframe.CellElementPropertyPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.menu.ShortCut;
import com.fr.design.selection.QuickEditor; import com.fr.design.selection.QuickEditor;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.TemplateCellElement;
import com.fr.stable.ColumnRow; import com.fr.stable.ColumnRow;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.*;
import java.awt.event.ActionListener; import java.util.ArrayList;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
/** /**
* @author zhou * @author zhou, yaoh.wu
* @since 2012-7-23下午5:16:53 * @version 2017年8月7日16点54分
* @since 1.0
*/ */
public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> { public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
/*滚动条相关配置*/
private static final int MAXVALUE = 100;
private static final int TITLE_HEIGHT = 50;
private static final int MOUSE_WHEEL_SPEED = 5;
private static final int CONTENT_PANE_WIDTH_GAP = 4;
private static final int SCROLLBAR_WIDTH = 8;
private int maxHeight = 280;
/*面板配置*/
protected UITextField columnRowTextField; protected UITextField columnRowTextField;
private UIButton cellElementEditButton;
protected TemplateCellElement cellElement; protected TemplateCellElement cellElement;
private UIComboBox comboBox;
private UpdateAction[] cellInsertActions;
private int selectedIndex;
private JPanel leftContentPane;
private UIScrollBar scrollBar;
/*占位label*/
protected static UILabel emptyLabel = new UILabel();
static {
emptyLabel.setPreferredSize(new Dimension(60, 20));
}
protected static final int VGAP = 10, HGAP = 8;
public CellQuickEditor() { public CellQuickEditor() {
scrollBar = new UIScrollBar(UIScrollBar.VERTICAL) {
@Override
public int getVisibleAmount() {
int preferredHeight = leftContentPane.getPreferredSize().height;
int e = MAXVALUE * (maxHeight) / preferredHeight;
setVisibleAmount(e);
return e;
}
@Override
public int getMaximum() {
return MAXVALUE;
}
};
scrollBar.addAdjustmentListener(new AdjustmentListener() {
@Override
public void adjustmentValueChanged(AdjustmentEvent e) {
doLayout();
}
});
this.addMouseWheelListener(new MouseWheelListener() {
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
int value = scrollBar.getValue();
value += MOUSE_WHEEL_SPEED * e.getWheelRotation();
scrollBar.setValue(value);
doLayout();
}
});
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {p, f};
double[] rowSize = {p, p};
JComponent centerBody = createCenterBody();
centerBody.setBorder(BorderFactory.createMatteBorder(0, 10, 0, 0, this.getBackground()));
Component[][] components = new Component[][]{
new Component[]{initTopContent(), null},
new Component[]{centerBody, null}
};
leftContentPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP);
this.setLayout(new BarLayout());
this.add(scrollBar);
this.add(leftContentPane);
}
private JPanel initTopContent() {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {p, f}; double[] columnSize = {p, f};
double[] rowSize = {p, p, p}; double[] rowSize = {p, p};
UILabel cellLabel = new UILabel(Inter.getLocText("Cell"));
cellLabel.setPreferredSize(new Dimension(60, 20));
UILabel insertContentLabel = new UILabel(Inter.getLocText("HF-Insert_Content"));
insertContentLabel.setPreferredSize(new Dimension(60, 20));
UIComboBox cellElementEditButton = initCellElementEditComboBox();
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(" " + Inter.getLocText("Cell")), columnRowTextField = initColumnRowTextField()}, new Component[]{cellLabel, columnRowTextField = initColumnRowTextField()},
new Component[]{new UILabel(Inter.getLocText("HF-Insert_Content") + " "), cellElementEditButton = initCellElementEditButton()}, new Component[]{insertContentLabel, cellElementEditButton},
new Component[]{createCenterBody(), null}
}; };
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel topContent = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP);
this.setLayout(new BorderLayout()); topContent.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 0));
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); return topContent;
this.add(panel, BorderLayout.CENTER);
} }
/** /**
* 初始化添加按钮 * 初始化添加按钮
* TODO 9.0 换成下拉菜单后原来的快捷键不好处理先跳过
* *
* @return UIButton * @return UIButton
*/ */
private UIButton initCellElementEditButton() { private UIComboBox initCellElementEditComboBox() {
final UIButton cellElementEditButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); final String[] items = getDefaultComboBoxItems();
cellElementEditButton.addMouseListener(new MouseAdapter() { comboBox = new UIComboBox(items);
final Object comboBoxSelected = getComboBoxSelected();
if (comboBoxSelected != null) {
comboBox.setSelectedItem(((ShortCut) comboBoxSelected).getMenuKeySet().getMenuKeySetName());
} else {
comboBox.setSelectedIndex(1);
}
comboBox.addPopupMenuListener(new PopupMenuListener() {
@Override
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
if (cellInsertActions == null) {
cellInsertActions = ActionFactory.createCellInsertAction(ElementCasePane.class, tc);
}
// 这边重新获取是因为要根据JTemplate做一个过滤
ArrayList<String> arrayList = new ArrayList<String>();
for (UpdateAction action : cellInsertActions) {
arrayList.add(action.getMenuKeySet().getMenuKeySetName());
}
comboBox.setModel(new DefaultComboBoxModel<>(arrayList.toArray(new String[arrayList.size()])));
}
@Override
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
}
@Override @Override
public void mousePressed(MouseEvent evt) { public void popupMenuCanceled(PopupMenuEvent e) {
GUICoreUtils.showPopMenuWithParentWidth(DeprecatedActionManager.getCellMenu(tc).createJPopupMenu(), cellElementEditButton, 0, cellElementEditButton.getY() - 6); }
});
comboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
selectedIndex = comboBox.getSelectedIndex();
cellInsertActions[selectedIndex].actionPerformed(e);
} }
}); });
return cellElementEditButton; return comboBox;
}
private String[] getDefaultComboBoxItems() {
MenuKeySet[] cellInsertActionNames = ActionFactory.createCellInsertActionName();
ArrayList<String> names = new ArrayList<>();
for (MenuKeySet cellInsertActionName : cellInsertActionNames) {
names.add(cellInsertActionName.getMenuKeySetName());
}
return names.toArray(new String[names.size()]);
} }
/** /**
@ -110,6 +228,14 @@ public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
*/ */
public abstract JComponent createCenterBody(); public abstract JComponent createCenterBody();
/**
* 初始化下拉框中的类型
*
* @return JComponent 待显示的详细信息面板
*/
public abstract Object getComboBoxSelected();
/** /**
* 刷新 * 刷新
*/ */
@ -126,4 +252,55 @@ public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
* 刷新详细信息 * 刷新详细信息
*/ */
protected abstract void refreshDetails(); protected abstract void refreshDetails();
/**
* 属性面板的滚动条和内容区域的布局管理类
* yaoh.wu 由于这边不能继承{@link com.fr.design.mainframe.AbstractAttrPane.BarLayout}所以冗余了一份滚动条代码进来
*
* @see com.fr.design.mainframe.AbstractAttrPane.BarLayout
*/
protected class BarLayout implements LayoutManager {
@Override
public void addLayoutComponent(String name, Component comp) {
}
@Override
public void removeLayoutComponent(Component comp) {
}
@Override
public Dimension preferredLayoutSize(Container parent) {
return leftContentPane.getPreferredSize();
}
@Override
public Dimension minimumLayoutSize(Container parent) {
return leftContentPane.getMinimumSize();
}
@Override
public void layoutContainer(Container parent) {
maxHeight = CellElementPropertyPane.getInstance().getHeight() - TITLE_HEIGHT;
int beginY;
if ((MAXVALUE - scrollBar.getVisibleAmount()) == 0) {
beginY = 0;
} else {
int preferredHeight = leftContentPane.getPreferredSize().height;
int value = scrollBar.getValue();
beginY = value * (preferredHeight - maxHeight) / (MAXVALUE - scrollBar.getVisibleAmount());
}
int width = parent.getWidth();
int height = parent.getHeight();
if (leftContentPane.getPreferredSize().height > maxHeight) {
leftContentPane.setBounds(0, -beginY, width - scrollBar.getWidth() - CONTENT_PANE_WIDTH_GAP, height + beginY);
scrollBar.setBounds(width - scrollBar.getWidth() - 1, 0, scrollBar.getWidth(), height);
} else {
leftContentPane.setBounds(0, 0, width - SCROLLBAR_WIDTH - CONTENT_PANE_WIDTH_GAP, height);
}
leftContentPane.validate();
}
}
} }

2
designer/src/com/fr/quickeditor/ChartQuickEditor.java

@ -1,7 +1,7 @@
package com.fr.quickeditor; package com.fr.quickeditor;
import com.fr.base.chart.BaseChartCollection; import com.fr.base.chart.BaseChartCollection;
import com.fr.chart.chartattr.ChartCollection; //import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
import com.fr.design.gui.chart.BaseChartPropertyPane; import com.fr.design.gui.chart.BaseChartPropertyPane;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;

30
designer/src/com/fr/quickeditor/cellquick/CellBiasTextPainterEditor.java

@ -1,9 +1,12 @@
package com.fr.quickeditor.cellquick; package com.fr.quickeditor.cellquick;
import com.fr.base.BaseUtils; import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.insert.cell.BiasCellAction;
import com.fr.design.cell.editor.BiasTextPainterCellEditor.BiasTextPainterPane; import com.fr.design.cell.editor.BiasTextPainterCellEditor.BiasTextPainterPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -11,29 +14,36 @@ import com.fr.quickeditor.CellQuickEditor;
import com.fr.report.cell.painter.BiasTextPainter; import com.fr.report.cell.painter.BiasTextPainter;
import javax.swing.*; import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
/** /**
* 单元格元素斜线编辑器 * 单元格元素斜线编辑器
* TODO 9.0 大体没有改动
*/ */
public class CellBiasTextPainterEditor extends CellQuickEditor { public class CellBiasTextPainterEditor extends CellQuickEditor {
@Override @Override
public JComponent createCenterBody() { public JComponent createCenterBody() {
UIButton editbutton = new UIButton(Inter.getLocText("Edit"), BaseUtils.readIcon("/com/fr/design/images/m_insert/bias.png")); JPanel content = new JPanel(new BorderLayout());
editbutton.addActionListener(new ActionListener() { UIButton editButton = new UIButton(Inter.getLocText("Edit"));
editButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
showEditingDialog(); showEditingDialog();
} }
}); });
editbutton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); editButton.setOpaque(false);
editbutton.setMargin(null); content.add(TableLayoutHelper.createGapTableLayoutPane(new Component[][]{
editbutton.setOpaque(false); new Component[]{emptyLabel, editButton}},
return editbutton; new double[]{TableLayout.PREFERRED},
new double[]{TableLayout.PREFERRED, TableLayout.FILL}, HGAP, VGAP), BorderLayout.CENTER);
return content;
}
@Override
public Object getComboBoxSelected() {
return ActionFactory.createAction(BiasCellAction.class);
} }
private void showEditingDialog() { private void showEditingDialog() {
@ -56,8 +66,6 @@ public class CellBiasTextPainterEditor extends CellQuickEditor {
@Override @Override
protected void refreshDetails() { protected void refreshDetails() {
// TODO Auto-generated method stub
} }
} }

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

File diff suppressed because it is too large Load Diff

206
designer/src/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java

@ -0,0 +1,206 @@
package com.fr.quickeditor.cellquick;
import com.fr.base.Formula;
import com.fr.base.Style;
import com.fr.base.TextFormat;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.insert.cell.FormulaCellAction;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.formula.FormulaFactory;
import com.fr.design.formula.UIFormula;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.grid.selection.CellSelection;
import com.fr.quickeditor.CellQuickEditor;
import com.fr.report.ReportHelper;
import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.stable.ColumnRow;
import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
/**
* 公式快速编辑面板同文本数字编辑拆分
*
* @author yaoh.wu
* @version 2017年8月7日10点44分
* @since 9.0
*/
public class CellFormulaQuickEditor extends CellQuickEditor {
//文本域
private UITextField formulaTextField;
//编辑状态
private boolean isEditing = false;
//编辑的是公式,要保留公式里的这些属性,不然在公式和字符串转化时,就会丢失这些属性设置。
private boolean reserveInResult = false;
private boolean reserveOnWriteOrAnaly = true;
//默认值
private static final String DEFAULT_FORMULA = "=";
private DocumentListener documentListener = new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
changeReportPaneCell(formulaTextField.getText().trim());
}
@Override
public void removeUpdate(DocumentEvent e) {
changeReportPaneCell(formulaTextField.getText().trim());
}
@Override
public void changedUpdate(DocumentEvent e) {
changeReportPaneCell(formulaTextField.getText().trim());
}
};
private CellFormulaQuickEditor() {
super();
}
/**
* 详细信息面板
*/
@Override
public JComponent createCenterBody() {
JPanel content = new JPanel(new BorderLayout());
formulaTextField = new UITextField();
formulaTextField.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
if (tc != null) {
tc.getGrid().dispatchEvent(e);
}
}
});
JPanel textFieldPane = new JPanel(new BorderLayout());
textFieldPane.add(formulaTextField, BorderLayout.CENTER);
textFieldPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
UIButton formulaButton = new UIButton(IOUtils.readIcon("/com/fr/design/images/m_insert/formula.png"));
formulaButton.setToolTipText(Inter.getLocText("Formula") + "...");
formulaButton.setPreferredSize(new Dimension(20, formulaTextField.getPreferredSize().height));
formulaButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
String text = formulaTextField.getText();
final UIFormula formulaPane = FormulaFactory.createFormulaPane();
formulaPane.populate(new Formula(text));
formulaPane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
Formula fm = formulaPane.update();
if (fm.getContent().length() <= 1) {
formulaTextField.setText(DEFAULT_FORMULA);
} else {
formulaTextField.setText(fm.getContent());
}
}
}).setVisible(true);
}
});
JPanel pane = new JPanel(new BorderLayout());
pane.add(textFieldPane, BorderLayout.CENTER);
pane.add(formulaButton, BorderLayout.EAST);
content.add(pane, BorderLayout.NORTH);
return TableLayoutHelper.createGapTableLayoutPane(new Component[][]{
new Component[]{emptyLabel, content}},
new double[]{TableLayout.PREFERRED},
new double[]{TableLayout.PREFERRED, TableLayout.FILL}, HGAP, VGAP);
}
@Override
public Object getComboBoxSelected() {
return ActionFactory.createAction(FormulaCellAction.class);
}
private void changeReportPaneCell(String tmpText) {
isEditing = true;
//refresh一下,如果单元格内有新添加的控件,此时并不知道
CellSelection cs1 = (CellSelection) tc.getSelection();
ColumnRow columnRow = ColumnRow.valueOf(cs1.getColumn(), cs1.getRow());
columnRowTextField.setText(columnRow.toString());
cellElement = tc.getEditingElementCase().getTemplateCellElement(cs1.getColumn(), cs1.getRow());
if (cellElement == null) {
CellSelection cs = (CellSelection) tc.getSelection();
cellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow());
tc.getEditingElementCase().addCellElement(cellElement, false);
}
if (tmpText != null && (tmpText.length() > 0 && tmpText.charAt(0) == '=')) {
Formula textFormula = new Formula(tmpText);
textFormula.setReserveInResult(reserveInResult);
textFormula.setReserveOnWriteOrAnaly(reserveOnWriteOrAnaly);
cellElement.setValue(textFormula);
} else {
Style style = cellElement.getStyle();
if (style != null && style.getFormat() != null && style.getFormat() == TextFormat.getInstance()) {
cellElement.setValue(tmpText);
} else {
cellElement.setValue(ReportHelper.convertGeneralStringAccordingToExcel(tmpText));
}
}
fireTargetModified();
formulaTextField.requestFocus();
isEditing = false;
}
/**
* 刷新详细内容
*/
@Override
protected void refreshDetails() {
String str;
if (cellElement == null) {
str = StringUtils.EMPTY;
} else {
Object value = cellElement.getValue();
if (value == null) {
str = StringUtils.EMPTY;
} else if (value instanceof Formula) {
Formula formula = (Formula) value;
str = formula.getContent();
reserveInResult = formula.isReserveInResult();
reserveOnWriteOrAnaly = formula.isReserveOnWriteOrAnaly();
} else {
str = value.toString();
}
}
showText(str);
formulaTextField.setEditable(tc.isSelectedOneCell());
}
/**
* 显示文本
*
* @param str 文本
*/
public void showText(String str) {
// 正在编辑时不处理
if (isEditing) {
return;
}
formulaTextField.getDocument().removeDocumentListener(documentListener);
formulaTextField.setText(str);
formulaTextField.getDocument().addDocumentListener(documentListener);
}
}

40
designer/src/com/fr/quickeditor/cellquick/CellImageQuickEditor.java

@ -1,9 +1,12 @@
package com.fr.quickeditor.cellquick; package com.fr.quickeditor.cellquick;
import com.fr.base.BaseUtils;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.insert.cell.ImageCellAction;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.report.SelectImagePane; import com.fr.design.report.SelectImagePane;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -12,22 +15,17 @@ import com.fr.quickeditor.CellQuickEditor;
import com.fr.report.cell.cellattr.CellImage; import com.fr.report.cell.cellattr.CellImage;
import javax.swing.*; import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
/** /**
* 单元格元素图片编辑器 * 单元格元素图片编辑器
* TODO 9.0大体上没有改动 *
* @author yaoh.wu
* @version 2017年8月7日10点53分
*/ */
public class CellImageQuickEditor extends CellQuickEditor { public class CellImageQuickEditor extends CellQuickEditor {
private static CellImageQuickEditor THIS;
public static final CellImageQuickEditor getInstance() {
if (THIS == null) {
THIS = new CellImageQuickEditor();
}
return THIS;
}
private CellImageQuickEditor() { private CellImageQuickEditor() {
super(); super();
@ -35,18 +33,20 @@ public class CellImageQuickEditor extends CellQuickEditor {
@Override @Override
public JComponent createCenterBody() { public JComponent createCenterBody() {
UIButton editbutton = new UIButton(Inter.getLocText("Edit"), BaseUtils.readIcon("/com/fr/design/images/m_insert/image.png")); JPanel content = new JPanel(new BorderLayout());
editbutton.addActionListener(new ActionListener() { UIButton editButton = new UIButton(Inter.getLocText("Edit"));
editButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
showEditingDialog(); showEditingDialog();
} }
}); });
editbutton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); editButton.setOpaque(false);
editbutton.setMargin(null); content.add(TableLayoutHelper.createGapTableLayoutPane(new Component[][]{
editbutton.setOpaque(false); new Component[]{emptyLabel, editButton}},
return editbutton; new double[]{TableLayout.PREFERRED},
new double[]{TableLayout.PREFERRED, TableLayout.FILL}, HGAP, VGAP), BorderLayout.CENTER);
return content;
} }
private void showEditingDialog() { private void showEditingDialog() {
@ -55,7 +55,6 @@ public class CellImageQuickEditor extends CellQuickEditor {
final Object oldValue = cellElement.getValue(); final Object oldValue = cellElement.getValue();
final Style oldStyle = cellElement.getStyle(); final Style oldStyle = cellElement.getStyle();
imageEditorPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { imageEditorPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
CellImage cellImage = imageEditorPane.update(); CellImage cellImage = imageEditorPane.update();
@ -65,7 +64,6 @@ public class CellImageQuickEditor extends CellQuickEditor {
fireTargetModified(); fireTargetModified();
} }
} }
}).setVisible(true); }).setVisible(true);
} }
@ -74,4 +72,8 @@ public class CellImageQuickEditor extends CellQuickEditor {
} }
@Override
public Object getComboBoxSelected() {
return ActionFactory.createAction(ImageCellAction.class);
}
} }

48
designer/src/com/fr/quickeditor/cellquick/CellRichTextEditor.java

@ -1,50 +1,52 @@
package com.fr.quickeditor.cellquick; package com.fr.quickeditor.cellquick;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.insert.cell.RichTextCellAction; import com.fr.design.actions.insert.cell.RichTextCellAction;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.quickeditor.CellQuickEditor; import com.fr.quickeditor.CellQuickEditor;
import javax.swing.*; import javax.swing.*;
import java.awt.*;
/** /**
* 单元格元素富文本编辑器 * 单元格元素富文本编辑器
* TODO 9.0 大体上没有改动 *
* @author yaoh.wu
* @version 2017年8月7日10点53分
*/ */
public class CellRichTextEditor extends CellQuickEditor { public class CellRichTextEditor extends CellQuickEditor {
private UIButton subReportButton; private UIButton richTextButton;
private static CellRichTextEditor THIS;
public static final CellRichTextEditor getInstance() {
if (THIS == null) {
THIS = new CellRichTextEditor();
}
return THIS;
}
private CellRichTextEditor() { private CellRichTextEditor() {
super(); super();
} }
/** @Override
* 创建界面上中间的部分
*
* @return 界面元素
* @date 2014-12-7-下午9:41:52
*/
public JComponent createCenterBody() { public JComponent createCenterBody() {
subReportButton = new UIButton(); JPanel content = new JPanel(new BorderLayout());
subReportButton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); richTextButton = new UIButton();
subReportButton.setMargin(null); richTextButton.setOpaque(false);
subReportButton.setOpaque(false); content.add(TableLayoutHelper.createGapTableLayoutPane(new Component[][]{
return subReportButton; new Component[]{emptyLabel, richTextButton}},
new double[]{TableLayout.PREFERRED},
new double[]{TableLayout.PREFERRED, TableLayout.FILL}, HGAP, VGAP), BorderLayout.CENTER);
return content;
}
@Override
public Object getComboBoxSelected() {
return ActionFactory.createAction(RichTextCellAction.class);
} }
@Override @Override
protected void refreshDetails() { protected void refreshDetails() {
RichTextCellAction subReportCellAction = new RichTextCellAction(tc); RichTextCellAction subReportCellAction = new RichTextCellAction(tc);
subReportCellAction.setName(Inter.getLocText("FR-Designer_RichTextEditor")); subReportCellAction.setName(Inter.getLocText("Edit"));
subReportButton.setAction(subReportCellAction); subReportCellAction.setSmallIcon(null);
richTextButton.setAction(subReportCellAction);
} }
} }

65
designer/src/com/fr/quickeditor/cellquick/CellStringQuickEditor.java

@ -3,7 +3,8 @@ package com.fr.quickeditor.cellquick;
import com.fr.base.Formula; import com.fr.base.Formula;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.TextFormat; import com.fr.base.TextFormat;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextarea.UITextArea;
import com.fr.grid.GridKeyListener;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.quickeditor.CellQuickEditor; import com.fr.quickeditor.CellQuickEditor;
import com.fr.report.ReportHelper; import com.fr.report.ReportHelper;
@ -14,6 +15,7 @@ import com.fr.stable.StringUtils;
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 java.awt.*;
import java.awt.event.KeyAdapter; import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
@ -21,21 +23,11 @@ import java.awt.event.KeyEvent;
* *
*/ */
public class CellStringQuickEditor extends CellQuickEditor { public class CellStringQuickEditor extends CellQuickEditor {
//instance //文本域 直接可以自适应大小
private static CellStringQuickEditor THIS; private UITextArea stringTextArea;
//文本域
//TODO 9.0 文本域要根据具体文本数量自适应大小,比较难搞,先跳过。
private UITextField stringTextField;
//编辑状态 //编辑状态
private boolean isEditing = false; private boolean isEditing = false;
public static CellStringQuickEditor getInstance() {
if (THIS == null) {
THIS = new CellStringQuickEditor();
}
return THIS;
}
//august:如果是原来编辑的是公式,要保留公式里的这些属性,不然在公式和字符串转化时,就会丢失这些属性设置。 //august:如果是原来编辑的是公式,要保留公式里的这些属性,不然在公式和字符串转化时,就会丢失这些属性设置。
private boolean reserveInResult = false; private boolean reserveInResult = false;
private boolean reserveOnWriteOrAnaly = true; private boolean reserveOnWriteOrAnaly = true;
@ -43,17 +35,17 @@ public class CellStringQuickEditor extends CellQuickEditor {
private DocumentListener documentListener = new DocumentListener() { private DocumentListener documentListener = new DocumentListener() {
@Override @Override
public void insertUpdate(DocumentEvent e) { public void insertUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim()); changeReportPaneCell(stringTextArea.getText().trim());
} }
@Override @Override
public void removeUpdate(DocumentEvent e) { public void removeUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim()); changeReportPaneCell(stringTextArea.getText().trim());
} }
@Override @Override
public void changedUpdate(DocumentEvent e) { public void changedUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim()); changeReportPaneCell(stringTextArea.getText().trim());
} }
}; };
@ -64,20 +56,38 @@ public class CellStringQuickEditor extends CellQuickEditor {
/** /**
* 详细信息面板 * 详细信息面板
* todo 文本框可自适应大小公式编辑也是在这边如果是公式那么要加一个公式编辑器的触发按钮
*/ */
@Override @Override
public JComponent createCenterBody() { public JComponent createCenterBody() {
stringTextField = new UITextField(); JPanel content = new JPanel(new BorderLayout());
stringTextField.addKeyListener(new KeyAdapter() { stringTextArea = new UITextArea();
stringTextArea.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (tc == null) {
return;
}
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
//todo 按enter键换至下一个单元格 yaoh.wu虽然模仿选中单元格按enter这种场景可以做到,但是原理没有弄清楚。
GridKeyListener dispatchListener = new GridKeyListener(tc.getGrid());
dispatchListener.keyPressed(e);
dispatchListener.keyTyped(e);
}
}
@Override @Override
public void keyReleased(KeyEvent e) { public void keyReleased(KeyEvent e) {
if (tc != null) { if (tc != null) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
return;
}
tc.getGrid().dispatchEvent(e); tc.getGrid().dispatchEvent(e);
} }
} }
}); });
return stringTextField; content.add(stringTextArea, BorderLayout.CENTER);
return content;
} }
@ -108,7 +118,7 @@ public class CellStringQuickEditor extends CellQuickEditor {
} }
} }
fireTargetModified(); fireTargetModified();
stringTextField.requestFocus(); stringTextArea.requestFocus();
isEditing = false; isEditing = false;
} }
@ -134,7 +144,7 @@ public class CellStringQuickEditor extends CellQuickEditor {
} }
} }
showText(str); showText(str);
stringTextField.setEditable(tc.isSelectedOneCell()); stringTextArea.setEditable(tc.isSelectedOneCell());
} }
/** /**
@ -147,9 +157,14 @@ public class CellStringQuickEditor extends CellQuickEditor {
if (isEditing) { if (isEditing) {
return; return;
} }
stringTextField.getDocument().removeDocumentListener(documentListener); stringTextArea.getDocument().removeDocumentListener(documentListener);
stringTextField.setText(str); stringTextArea.setText(str);
stringTextField.getDocument().addDocumentListener(documentListener); stringTextArea.getDocument().addDocumentListener(documentListener);
}
@Override
public Object getComboBoxSelected() {
return null;
} }
} }

32
designer/src/com/fr/quickeditor/cellquick/CellSubReportEditor.java

@ -1,26 +1,25 @@
package com.fr.quickeditor.cellquick; package com.fr.quickeditor.cellquick;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.insert.cell.SubReportCellAction; import com.fr.design.actions.insert.cell.SubReportCellAction;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.quickeditor.CellQuickEditor; import com.fr.quickeditor.CellQuickEditor;
import javax.swing.*; import javax.swing.*;
import java.awt.*;
/** /**
* 单元格元素子报表编辑器 * 单元格元素子报表编辑器
* TODO 9.0大体上没有改动 *
* @author yaoh.wu
* @version 2017年8月7日10点53分
*/ */
public class CellSubReportEditor extends CellQuickEditor { public class CellSubReportEditor extends CellQuickEditor {
private UIButton subReportButton; private UIButton subReportButton;
private static CellSubReportEditor THIS;
public static final CellSubReportEditor getInstance() {
if (THIS == null) {
THIS = new CellSubReportEditor();
}
return THIS;
}
private CellSubReportEditor() { private CellSubReportEditor() {
super(); super();
@ -28,18 +27,27 @@ public class CellSubReportEditor extends CellQuickEditor {
@Override @Override
public JComponent createCenterBody() { public JComponent createCenterBody() {
JPanel content = new JPanel(new BorderLayout());
subReportButton = new UIButton(); subReportButton = new UIButton();
subReportButton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
subReportButton.setMargin(null);
subReportButton.setOpaque(false); subReportButton.setOpaque(false);
return subReportButton; content.add(TableLayoutHelper.createGapTableLayoutPane(new Component[][]{
new Component[]{emptyLabel, subReportButton}},
new double[]{TableLayout.PREFERRED},
new double[]{TableLayout.PREFERRED, TableLayout.FILL}, HGAP, VGAP), BorderLayout.CENTER);
return content;
} }
@Override @Override
protected void refreshDetails() { protected void refreshDetails() {
SubReportCellAction subReportCellAction = new SubReportCellAction(tc); SubReportCellAction subReportCellAction = new SubReportCellAction(tc);
subReportCellAction.setName(Inter.getLocText(new String[]{"Edit", "Sub_Report"})); subReportCellAction.setName(Inter.getLocText("Edit"));
subReportCellAction.setSmallIcon(null);
subReportButton.setAction(subReportCellAction); subReportButton.setAction(subReportCellAction);
} }
@Override
public Object getComboBoxSelected() {
return ActionFactory.createAction(SubReportCellAction.class);
}
} }

2
designer/src/com/fr/quickeditor/floatquick/FloatImageQuickEditor.java

@ -42,7 +42,7 @@ public class FloatImageQuickEditor extends FloatQuickEditor {
JPanel pane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel pane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(10, 78, 10, 17)); this.setBorder(BorderFactory.createEmptyBorder(10, 75, 10, 15));
this.add(pane, BorderLayout.CENTER); this.add(pane, BorderLayout.CENTER);

7
designer/src/com/fr/quickeditor/floatquick/FloatStringQuickEditor.java

@ -4,6 +4,7 @@ import com.fr.base.BaseUtils;
import com.fr.base.Formula; import com.fr.base.Formula;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.TextFormat; import com.fr.base.TextFormat;
import com.fr.design.constants.UIConstants;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
@ -37,7 +38,7 @@ public class FloatStringQuickEditor extends FloatQuickEditor {
JPanel pane = new JPanel(new BorderLayout(5, 0)); JPanel pane = new JPanel(new BorderLayout(5, 0));
pane.add(stringTextField, BorderLayout.CENTER); pane.add(stringTextField, BorderLayout.CENTER);
pane.add(formulaButton, BorderLayout.EAST); pane.add(formulaButton, BorderLayout.EAST);
pane.setBorder(BorderFactory.createEmptyBorder(0,0,0,7)); pane.setBorder(BorderFactory.createEmptyBorder(0,0,0,5));
formulaButton.setVisible(false); formulaButton.setVisible(false);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
@ -50,7 +51,7 @@ public class FloatStringQuickEditor extends FloatQuickEditor {
stringTextField.setLineWrap(true); stringTextField.setLineWrap(true);
stringTextField.setWrapStyleWord(true); stringTextField.setWrapStyleWord(true);
stringTextField.setMargin(new Insets(5, 5, 5, 5)); stringTextField.setMargin(new Insets(5, 5, 5, 5));
stringTextField.setBorder(BorderFactory.createLineBorder(Color.gray)); stringTextField.setBorder(BorderFactory.createLineBorder(UIConstants.POP_DIALOG_BORDER));
stringTextField.setBackground(Color.WHITE); stringTextField.setBackground(Color.WHITE);
} }
@ -73,7 +74,7 @@ public class FloatStringQuickEditor extends FloatQuickEditor {
Formula formula = (Formula) value; Formula formula = (Formula) value;
str = formula.getContent(); str = formula.getContent();
stringTextField.setLineWrap(false); stringTextField.setLineWrap(false);
this.setBorder(BorderFactory.createEmptyBorder(10, 78, 10, 10)); this.setBorder(BorderFactory.createEmptyBorder(10, 75, 10, 10));
reserveInResult = formula.isReserveInResult(); reserveInResult = formula.isReserveInResult();
reserveOnWriteOrAnaly = formula.isReserveOnWriteOrAnaly(); reserveOnWriteOrAnaly = formula.isReserveOnWriteOrAnaly();
} else { } else {

42
designer_base/src/com/fr/design/actions/TemplateComponentAction.java

@ -4,30 +4,34 @@ package com.fr.design.actions;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
public abstract class TemplateComponentAction<T extends TargetComponent> extends UndoableAction implements TemplateComponentActionInterface<T> { public abstract class TemplateComponentAction<T extends TargetComponent> extends UndoableAction implements TemplateComponentActionInterface<T> {
private T t; private T t;
protected TemplateComponentAction(T t) {
this.t = t; protected TemplateComponentAction() {
} }
protected void setEditingComponent(T t) { protected TemplateComponentAction(T t) {
this.t = t; this.t = t;
} }
@Override protected void setEditingComponent(T t) {
public T getEditingComponent() { this.t = t;
return t; }
}
@Override
@Override public T getEditingComponent() {
public void prepare4Undo() { return t;
this.getEditingComponent().fireTargetModified(); }
@Override
public void prepare4Undo() {
this.getEditingComponent().fireTargetModified();
T component = getEditingComponent(); T component = getEditingComponent();
if (component == null) { if (component == null) {
return; return;
} }
component.requestFocus(); component.requestFocus();
} }
/** /**
* update enable * update enable
@ -35,6 +39,6 @@ public abstract class TemplateComponentAction<T extends TargetComponent> extends
*/ */
@Override @Override
public void update() { public void update() {
this.setEnabled(this.getEditingComponent() != null); this.setEnabled(this.getEditingComponent() != null);
} }
} }

34
designer_base/src/com/fr/design/actions/core/ActionFactory.java

@ -5,6 +5,7 @@ import com.fr.base.Utils;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.selection.QuickEditor; import com.fr.design.selection.QuickEditor;
import javax.swing.*; import javax.swing.*;
@ -132,6 +133,17 @@ public class ActionFactory {
return createEditor(clazz, cellEditor); return createEditor(clazz, cellEditor);
} }
public static UpdateAction createAction(Class clazz) {
try {
Constructor<? extends UpdateAction> c = clazz.getDeclaredConstructor();
c.setAccessible(true);
return c.newInstance();
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}
return null;
}
/** /**
* peter:从Action来产生ToolTipText. * peter:从Action来产生ToolTipText.
* *
@ -190,7 +202,7 @@ public class ActionFactory {
} }
if (jTemplate.acceptToolbarItem(clazz)) { if (jTemplate.acceptToolbarItem(clazz)) {
try { try {
Constructor<? extends UpdateAction> c = (Constructor<? extends UpdateAction>)clazz.getConstructor(cls); Constructor<? extends UpdateAction> c = (Constructor<? extends UpdateAction>) clazz.getConstructor(cls);
actions.add(c.newInstance(obj)); actions.add(c.newInstance(obj));
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FRContext.getLogger().error(e.getMessage(), e);
@ -200,6 +212,24 @@ public class ActionFactory {
return actions.toArray(new UpdateAction[actions.size()]); return actions.toArray(new UpdateAction[actions.size()]);
} }
public static MenuKeySet[] createCellInsertActionName() {
List<MenuKeySet> actionNames = new ArrayList<>();
for (Class<?> clazz : actionClasses) {
if (clazz == null) {
continue;
}
try {
Constructor<? extends UpdateAction> c = (Constructor<? extends UpdateAction>) clazz.getConstructor();
actionNames.add(c.newInstance().getMenuKeySet());
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}
}
return actionNames.toArray(new MenuKeySet[actionNames.size()]);
}
/** /**
* 登记悬浮元素插入类型 * 登记悬浮元素插入类型
* *
@ -225,7 +255,7 @@ public class ActionFactory {
continue; continue;
} }
try { try {
Constructor<? extends UpdateAction> c = (Constructor<? extends UpdateAction>)clazz.getConstructor(cls); Constructor<? extends UpdateAction> c = (Constructor<? extends UpdateAction>) clazz.getConstructor(cls);
actions.add(c.newInstance(obj)); actions.add(c.newInstance(obj));
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FRContext.getLogger().error(e.getMessage(), e);

12
designer_base/src/com/fr/design/actions/file/SwitchExistEnv.java

@ -3,11 +3,13 @@ package com.fr.design.actions.file;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Env; import com.fr.base.Env;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.data.DesignTableDataManager; import com.fr.base.FRCoreContext;
import com.fr.design.data.tabledata.ResponseDataSourceChange;
import com.fr.dav.LocalEnv; import com.fr.dav.LocalEnv;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.tabledata.ResponseDataSourceChange;
import com.fr.design.dialog.InformationWarnPane;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
@ -15,16 +17,14 @@ import com.fr.design.mainframe.TemplatePane;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.SeparatorDef;
import com.fr.design.dialog.InformationWarnPane;
import com.fr.env.RemoteEnv; import com.fr.env.RemoteEnv;
import com.fr.env.SignIn; import com.fr.env.SignIn;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.LicUtils;
import com.fr.stable.ProductConstants;
import com.fr.stable.EnvChangedListener; import com.fr.stable.EnvChangedListener;
import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
@ -118,7 +118,7 @@ public class SwitchExistEnv extends MenuDef {
return; return;
} }
SignIn.signIn(selectedEnv); SignIn.signIn(selectedEnv);
LicUtils.resetBytes(); FRCoreContext.resetBytes();
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshToolArea(); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshToolArea();
fireDSChanged(); fireDSChanged();
} catch (Exception em) { } catch (Exception em) {

4
designer_base/src/com/fr/design/border/UITitledBorder.java

@ -1,5 +1,7 @@
package com.fr.design.border; package com.fr.design.border;
import com.fr.design.constants.UIConstants;
import java.awt.Color; import java.awt.Color;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -19,7 +21,7 @@ public class UITitledBorder extends TitledBorder {
} }
private void init(String title){ private void init(String title){
UIRoundedBorder roundedborder = new UIRoundedBorder(new Color(204, 204, 204), 1, 10); UIRoundedBorder roundedborder = new UIRoundedBorder(UIConstants.TITLED_BORDER_COLOR, 1, 10);
this.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0), roundedborder)); this.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0), roundedborder));
this.setTitle(title); this.setTitle(title);

12
designer_base/src/com/fr/design/constants/UIConstants.java

@ -19,6 +19,7 @@ public interface UIConstants {
public static final Icon BLACK_ICON = BaseUtils.readIcon("/com/fr/base/images/cell/blank.gif"); public static final Icon BLACK_ICON = BaseUtils.readIcon("/com/fr/base/images/cell/blank.gif");
public static final Border CELL_ATTR_ZEROBORDER = BorderFactory.createEmptyBorder(0 ,0, 0, 0);
public static final Border CELL_ATTR_EMPTYBORDER = BorderFactory.createEmptyBorder(0 ,10, 0, 0); public static final Border CELL_ATTR_EMPTYBORDER = BorderFactory.createEmptyBorder(0 ,10, 0, 0);
public static final Border CELL_ATTR_NORMALBORDER = BorderFactory.createEmptyBorder(0 ,10, 0, 15); public static final Border CELL_ATTR_NORMALBORDER = BorderFactory.createEmptyBorder(0 ,10, 0, 15);
@ -86,9 +87,10 @@ public interface UIConstants {
public static final Color AUTHORITY_SHEET_DARK = new Color(86, 120, 143); public static final Color AUTHORITY_SHEET_DARK = new Color(86, 120, 143);
public static final Color AUTHORITY_SHEET_LIGHT = new Color(156, 204, 238); public static final Color AUTHORITY_SHEET_LIGHT = new Color(156, 204, 238);
public static final Color AUTHORITY_SHEET_UNSELECTED = new Color(146, 192, 225); public static final Color AUTHORITY_SHEET_UNSELECTED = new Color(146, 192, 225);
public static final Color ATTRIBUTE_PRESS = new Color(0xD8F2FD); public static final Color ATTRIBUTE_PRESS = new Color(0x419BF9);
public static final Color ATTRIBUTE_NORMAL = new Color(0xDADADD); public static final Color NORMAL_BLUE = new Color(0x419BF9);
public static final Color ATTRIBUTE_HOVER = new Color(0xC9C9CD); public static final Color ATTRIBUTE_NORMAL = Color.WHITE;
public static final Color ATTRIBUTE_HOVER = new Color(0xF5F5F7);
public static final Color CHECKBOX_HOVER_SELECTED = new Color(0x3394f0); public static final Color CHECKBOX_HOVER_SELECTED = new Color(0x3394f0);
public static final Color TEXT_FILED_BORDER_SELECTED = new Color(0x3384f0); public static final Color TEXT_FILED_BORDER_SELECTED = new Color(0x3384f0);
public static final Color SHEET_NORMAL = new Color(0xc8c8ca); public static final Color SHEET_NORMAL = new Color(0xc8c8ca);
@ -99,6 +101,8 @@ public interface UIConstants {
public static final Color RULER_SCALE_COLOR = new Color(0x4e504f); public static final Color RULER_SCALE_COLOR = new Color(0x4e504f);
public static final Color PROPERTY_PANE_BACKGROUND = new Color(0xdadadd); public static final Color PROPERTY_PANE_BACKGROUND = new Color(0xdadadd);
public static final Color SPLIT_LINE = new Color(201, 198, 184); public static final Color SPLIT_LINE = new Color(201, 198, 184);
public static final Color TITLED_BORDER_COLOR = new Color(0xededee);
public static final Color POP_DIALOG_BORDER = new Color(218, 218, 221);
public static final BufferedImage DRAG_BAR = BaseUtils.readImage("com/fr/design/images/control/bar.png"); public static final BufferedImage DRAG_BAR = BaseUtils.readImage("com/fr/design/images/control/bar.png");
@ -153,7 +157,7 @@ public interface UIConstants {
public static final Color BARNOMAL = new Color(232, 232, 233); public static final Color BARNOMAL = new Color(232, 232, 233);
public static final Color COMPONENT_BACKGROUND_COLOR = new Color(237,237,238); public static final Color COMPONENT_BACKGROUND_COLOR = new Color(237,237,238);
public static final int ARC = 0; public static final int ARC = 0;
public static final int BUTTON_GROUP_ARC = 6; public static final int BUTTON_GROUP_ARC = 0;
public static final int LARGEARC = 6; public static final int LARGEARC = 6;
public static final Stroke BS = new BasicStroke(1f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 2f, new float[]{3, 1}, 0); public static final Stroke BS = new BasicStroke(1f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 2f, new float[]{3, 1}, 0);
public static final Icon PREVIEW_DOWN = BaseUtils.readIcon("com/fr/design/images/buttonicon/prevew_down_icon.png"); public static final Icon PREVIEW_DOWN = BaseUtils.readIcon("com/fr/design/images/buttonicon/prevew_down_icon.png");

2
designer_base/src/com/fr/design/data/datapane/TableDataTree.java

@ -74,7 +74,7 @@ public class TableDataTree extends UserObjectRefreshJTree<TableDataSourceOP> {
dim.height += 2; dim.height += 2;
this.setSize(dim); this.setSize(dim);
this.setPreferredSize(dim); this.setPreferredSize(dim);
this.setBackgroundNonSelectionColor(UIConstants.NORMAL_BACKGROUND); this.setBackgroundNonSelectionColor(UIConstants.TREE_BACKGROUND);
this.setForeground(UIConstants.FONT_COLOR); this.setForeground(UIConstants.FONT_COLOR);
this.setBackgroundSelectionColor(UIConstants.FLESH_BLUE); this.setBackgroundSelectionColor(UIConstants.FLESH_BLUE);
return this; return this;

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

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

6
designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java

@ -1,5 +1,6 @@
package com.fr.design.gui.controlpane; package com.fr.design.gui.controlpane;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itoolbar.UIToolBarUI; import com.fr.design.gui.itoolbar.UIToolBarUI;
@ -276,7 +277,10 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
setUndecorated(true); setUndecorated(true);
pane.setBorder(BorderFactory.createEmptyBorder(20, 10, 10, 10)); pane.setBorder(BorderFactory.createEmptyBorder(20, 10, 10, 10));
this.editPane = pane; this.editPane = pane;
this.getContentPane().add(editPane, BorderLayout.CENTER); JPanel editPaneWrapper = new JPanel(new BorderLayout());
editPaneWrapper.add(editPane, BorderLayout.CENTER);
editPaneWrapper.setBorder(BorderFactory.createLineBorder(UIConstants.POP_DIALOG_BORDER, 1));
this.getContentPane().add(editPaneWrapper, BorderLayout.CENTER);
setSize(WIDTH, HEIGHT); setSize(WIDTH, HEIGHT);
// pack(); // pack();
this.setVisible(false); this.setVisible(false);

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

@ -16,6 +16,8 @@ import com.fr.general.Inter;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -53,9 +55,10 @@ public class RegPane extends BasicPane {
private RegPhonePane regPhonePane; private RegPhonePane regPhonePane;
private DefaultRegPane defaultRegPane; private DefaultRegPane defaultRegPane;
private CustomRegRexPane customRegRexPane; private CustomRegRexPane customRegRexPane;
protected RegErrorMsgPane regErrorMsgPane;
public UIComboBox getRegComboBox() { public UIComboBox getRegComboBox(){
return regComboBox; return regComboBox;
} }
@ -68,25 +71,16 @@ public class RegPane extends BasicPane {
this.initComponents(); this.initComponents();
} }
private void initComponents() { private void initComponents(){
this.setLayout(new BorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
regComboBox = new UIComboBox(regType); regComboBox = new UIComboBox(regType);
regComboBox.setRenderer(listCellRender); regComboBox.setRenderer(listCellRender);
double f = TableLayout.FILL; JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Input_Rule")), regComboBox}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
double p = TableLayout.PREFERRED; this.add(contentPane, BorderLayout.NORTH);
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
Component[][] components = new Component[][]{ regErrorMsgPane = new RegErrorMsgPane();
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Input_Rule") + " "), regComboBox},
};
double[] rowSize = {p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_LARGE);
panel.setBorder(BorderFactory.createEmptyBorder(8, 0, 0, 0));
this.add(panel, BorderLayout.NORTH);
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);
@ -94,26 +88,36 @@ 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");
cardPane.setBorder(BorderFactory.createEmptyBorder(8, 12, 0, 0)); centerPane.add(cardPane, BorderLayout.NORTH);
this.add(cardPane, BorderLayout.CENTER); centerPane.add(regErrorMsgPane, BorderLayout.CENTER);
regComboBox.addActionListener(new ActionListener() { this.add(centerPane, BorderLayout.CENTER);
regComboBox.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
RegExp regExp = (RegExp) regComboBox.getSelectedItem(); RegExp regExp = (RegExp)regComboBox.getSelectedItem();
if (regExp instanceof PhoneReg) { if(regExp instanceof PhoneReg) {
cardPane.setPreferredSize(new Dimension(220, 30));
Object selectItem = regPhonePane.dataTypeComboBox.getSelectedItem(); Object selectItem = regPhonePane.dataTypeComboBox.getSelectedItem();
String regString = selectItem == null ? StringUtils.EMPTY : selectItem.toString(); String regString = selectItem == null ? StringUtils.EMPTY : selectItem.toString();
firePhoneRegAction(regString); firePhoneRegAction(regString);
detailedCardLayout.show(cardPane, "Phone"); detailedCardLayout.show(cardPane, "Phone");
} else { } else {
if (regExp instanceof LengthReg) { if (regExp instanceof LengthReg){
cardPane.setPreferredSize(new Dimension(220, 60));
detailedCardLayout.show(cardPane, "Length"); detailedCardLayout.show(cardPane, "Length");
} else if (regExp instanceof CustomReg) { } else if (regExp instanceof CustomReg){
cardPane.setPreferredSize(new Dimension(220, 30));
detailedCardLayout.show(cardPane, "Custom"); detailedCardLayout.show(cardPane, "Custom");
} else { } else {
cardPane.setPreferredSize(new Dimension(0,0 ));
detailedCardLayout.show(cardPane, "Default"); detailedCardLayout.show(cardPane, "Default");
} }
fireRegChangeAction(); fireRegChangeAction();
} }
if(regExp instanceof NoneReg){
regErrorMsgPane.setVisible(false);
return;
}
regErrorMsgPane.setVisible(true);
} }
}); });
} }
@ -146,19 +150,21 @@ public class RegPane extends BasicPane {
} else { } else {
defaultRegPane.populate(regex); defaultRegPane.populate(regex);
} }
regErrorMsgPane.populate(regex);
} }
public RegExp update() { public RegExp update(){
RegExp regExp = (RegExp) regComboBox.getSelectedItem(); RegExp regExp = (RegExp)regComboBox.getSelectedItem();
regErrorMsgPane.update();
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();
} }
@ -177,7 +183,7 @@ public class RegPane extends BasicPane {
private static class DefaultRegPane extends DisplayPane { private static class DefaultRegPane extends DisplayPane {
public RegExp regRex; public RegExp regRex;
public DefaultRegPane() { public DefaultRegPane(){
} }
@ -203,7 +209,10 @@ public class RegPane extends BasicPane {
* 添加电话规则监听器 * 添加电话规则监听器
* *
* @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);
@ -213,7 +222,10 @@ public class RegPane extends BasicPane {
* 移除电话规则监听器 * 移除电话规则监听器
* *
* @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);
@ -223,7 +235,10 @@ public class RegPane extends BasicPane {
* 添加正则监听器 * 添加正则监听器
* *
* @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);
@ -233,7 +248,10 @@ public class RegPane extends BasicPane {
* 移除正则监听器 * 移除正则监听器
* *
* @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);
@ -241,45 +259,41 @@ public class RegPane extends BasicPane {
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) {
super(source); super(source);
this.setPhoneRegString(phoneRegString); this.setPhoneRegString(phoneRegString);
} }
public void setPhoneRegString(String phoneRegString) { public void setPhoneRegString(String phoneRegString) {
this.phoneRegString = phoneRegString; this.phoneRegString = phoneRegString;
} }
public String getPhoneRegString() { public String getPhoneRegString() {
return phoneRegString; return phoneRegString;
} }
} }
public class RegChangeEvent extends EventObject { public class RegChangeEvent extends EventObject {
private String regString; private String regString;
public RegChangeEvent(Object source, String regString) { public RegChangeEvent(Object source, String regString) {
super(source); super(source);
this.setRegString(regString); this.setRegString(regString);
} }
public void setRegString(String regString) { public void setRegString(String regString) {
this.regString = regString; this.regString = regString;
} }
public String getRegString() { public String getRegString() {
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);
@ -290,29 +304,28 @@ public class RegPane extends BasicPane {
/** /**
* 正则表达规则变化监听 * 正则表达规则变化监听
* *
*
* @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";
private static final String EMB_REG2 = "02585679591"; private static final String EMB_REG2 = "02585679591";
@ -322,19 +335,20 @@ public class RegPane extends BasicPane {
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);
public RegPhonePane() { public RegPhonePane() {
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); this.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 5));
this.add(new UILabel(Inter.getLocText("FR-Designer_Data_Type") + ":")); this.setLayout(FRGUIPaneFactory.createBorderLayout());
dataTypeComboBox = new UIComboBox(DefaultComboBoxModel); dataTypeComboBox = new UIComboBox(DefaultComboBoxModel);
JTextField editFiled = (JTextField) (dataTypeComboBox.getEditor().getEditorComponent()); JTextField editFiled = (JTextField)(dataTypeComboBox.getEditor().getEditorComponent());
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Data_Type")), dataTypeComboBox}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
this.add(panel);
editFiled.setDocument(new LimitedDocument(LIMIT_LENGTH, REG_PATTERN)); editFiled.setDocument(new LimitedDocument(LIMIT_LENGTH, REG_PATTERN));
dataTypeComboBox.addItemListener(new ItemListener() { dataTypeComboBox.addItemListener(new ItemListener() {
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) { if(e.getStateChange() == ItemEvent.SELECTED) {
if (ComparatorUtils.equals(e.getItem(), dataType[3])) { if(ComparatorUtils.equals(e.getItem(), dataType[3])) {
dataTypeComboBox.setSelectedItem(null); dataTypeComboBox.setSelectedItem(null);
dataTypeComboBox.setEditable(true); dataTypeComboBox.setEditable(true);
firePhoneRegAction(EMB_REG1); firePhoneRegAction(EMB_REG1);
@ -347,9 +361,7 @@ public class RegPane extends BasicPane {
}); });
dataTypeComboBox.setSelectedIndex(0); dataTypeComboBox.setSelectedIndex(0);
firePhoneRegAction(dataTypeComboBox.getSelectedItem().toString()); firePhoneRegAction(dataTypeComboBox.getSelectedItem().toString());
this.add(dataTypeComboBox);
} }
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return "PHONE"; return "PHONE";
@ -357,17 +369,17 @@ public class RegPane extends BasicPane {
@Override @Override
public void populate(RegExp regRex) { public void populate(RegExp regRex) {
if (!(regRex instanceof PhoneReg)) { if(!(regRex instanceof PhoneReg)) {
return; return ;
} }
String regstr = ((PhoneReg) regRex).getRegString(); String regstr = ((PhoneReg)regRex).getRegString();
if (checkEmbedded(regstr)) { if (checkEmbedded(regstr)){
DefaultComboBoxModel.addElement(regstr); DefaultComboBoxModel.addElement(regstr);
} }
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);
@ -376,7 +388,7 @@ public class RegPane extends BasicPane {
@Override @Override
public RegExp update() { public RegExp update() {
PhoneReg regRex = new PhoneReg(); PhoneReg regRex = new PhoneReg();
regRex.setRegString((String) (dataTypeComboBox.getSelectedItem())); regRex.setRegString((String)(dataTypeComboBox.getSelectedItem()));
return regRex; return regRex;
} }
} }
@ -385,22 +397,25 @@ public class RegPane extends BasicPane {
private UISpinner minLenSpinner; private UISpinner minLenSpinner;
private UISpinner maxLenSpinner; private UISpinner maxLenSpinner;
public RegLengthPane() { public RegLengthPane(){
this.setLayout(new BorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 5));
this.setPreferredSize(new Dimension(210, 56));
minLenSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0); minLenSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
maxLenSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0); maxLenSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Reg_Min_Length")), minLenSpinner}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_Reg_Min_Length") + ":"), minLenSpinner },
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Reg_Max_Length")), maxLenSpinner}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_Reg_Max_Length") + ":"), maxLenSpinner},
}; };
double[] rowSize = {p, p}; double[] rowSize = {p, p};
double[] columnSize = {p, f}; double[] columnSize = {p,f};
int[][] rowCount = {{1, 1}, {1, 1}}; int[][] rowCount = {{1, 1},{1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 8, 5); JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM);
this.add(panel);
this.add(panel, BorderLayout.CENTER);
} }
@Override @Override
@ -410,20 +425,20 @@ public class RegPane extends BasicPane {
@Override @Override
public void populate(RegExp regRex) { public void populate(RegExp regRex) {
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
public RegExp update() { public RegExp update() {
int startLength = ((Number) minLenSpinner.getValue()).intValue(); int startLength = ((Number)minLenSpinner.getValue()).intValue();
int endLength = ((Number) maxLenSpinner.getValue()).intValue(); int endLength = ((Number)maxLenSpinner.getValue()).intValue();
LengthReg regRex = new LengthReg(); LengthReg regRex = new LengthReg();
regRex.setMinLen(startLength); regRex.setMinLen(startLength);
regRex.setMaxLen(endLength); regRex.setMaxLen(endLength);
@ -432,22 +447,14 @@ public class RegPane extends BasicPane {
} }
} }
private static class CustomRegRexPane extends DisplayPane { private static class CustomRegRexPane extends DisplayPane{
private UITextField regTextField; private UITextField regTextField;
public CustomRegRexPane() { public CustomRegRexPane(){
this.setLayout(new BorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
regTextField = new UITextField(12); this.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 5));
regTextField = new UITextField();
double f = TableLayout.FILL; JPanel panel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Reg_Expressions")), regTextField}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Reg_Expressions")), regTextField},
};
double[] rowSize = {p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 2, 1);
this.add(panel); this.add(panel);
} }
@ -458,7 +465,7 @@ public class RegPane extends BasicPane {
@Override @Override
public void populate(RegExp regRex) { public void populate(RegExp regRex) {
if (!(regRex instanceof CustomReg)) { if (!(regRex instanceof CustomReg)){
return; return;
} }
regTextField.setText(regRex.toRegText()); regTextField.setText(regRex.toRegText());
@ -474,26 +481,77 @@ public class RegPane extends BasicPane {
} }
} }
ListCellRenderer listCellRender = new UIComboBoxRenderer() { private static class RegErrorMsgPane extends DisplayPane{
private UITextField regErrorMsgField;
public RegErrorMsgPane(){
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
initRegErrorMsgField();
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Widget_Error_Tip")), regErrorMsgField}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
this.add(panel);
}
private void initRegErrorMsgField(){
regErrorMsgField = new UITextField();
regErrorMsgField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
regErrorMsgField.setToolTipText(regErrorMsgField.getText());
}
public void insertUpdate(DocumentEvent e) {
regErrorMsgField.setToolTipText(regErrorMsgField.getText());
}
public void removeUpdate(DocumentEvent e) {
regErrorMsgField.setToolTipText(regErrorMsgField.getText());
}
});
}
@Override
protected String title4PopupWindow() {
return "CUSTOM";
}
@Override
public void populate(RegExp regRex) {
if (!(regRex instanceof CustomReg)){
return;
}
regErrorMsgField.setText(regRex.toRegText());
}
@Override
public RegExp update() {
return new CustomReg(regErrorMsgField.getText());
}
public boolean isEmpty() {
return StringUtils.isEmpty(regErrorMsgField.getText());
}
}
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"));
} else if (value instanceof LengthReg) { } else if (value instanceof LengthReg){
this.setText(Inter.getLocText("FR-Designer_Length")); this.setText(Inter.getLocText("FR-Designer_Length"));
} else if (value instanceof MailReg) { } else if (value instanceof MailReg){
this.setText(Inter.getLocText("FR-Designer_Email")); this.setText(Inter.getLocText("FR-Designer_Email"));
} else if (value instanceof PhoneReg) { } else if (value instanceof PhoneReg){
this.setText(Inter.getLocText("FR-Designer_Phone")); this.setText(Inter.getLocText("FR-Designer_Phone"));
} else if (value instanceof MobileReg) { } else if (value instanceof MobileReg) {
this.setText(Inter.getLocText("FR-Designer_MobilePhone")); this.setText(Inter.getLocText("FR-Designer_MobilePhone"));
} else if (value instanceof IDCardReg) { } else if (value instanceof IDCardReg){
this.setText(Inter.getLocText("FR-Designer_IDCard")); this.setText(Inter.getLocText("FR-Designer_IDCard"));
} else if (value instanceof PostCardReg) { } else if (value instanceof PostCardReg){
this.setText(Inter.getLocText("FR-Designer_PostCode")); this.setText(Inter.getLocText("FR-Designer_PostCode"));
} else if (value instanceof CustomReg) { } else if (value instanceof CustomReg){
this.setText(Inter.getLocText("FR-Designer_Custom")); this.setText(Inter.getLocText("FR-Designer_Custom"));
} }
return this; return this;

183
designer_base/src/com/fr/design/gui/frpane/ReportletParameterViewPane.java

@ -23,115 +23,124 @@ import java.util.List;
/** /**
* Defin hyperlink. * Defin hyperlink.
* in fact,this is a TablEditorPane * in fact,this is a TablEditorPane
*
* @editor zhou * @editor zhou
* @since 2012-3-23下午3:48:10 * @since 2012-3-23下午3:48:10
*/ */
public class ReportletParameterViewPane extends BasicPane { public class ReportletParameterViewPane extends BasicPane {
private UITableEditorPane<ParameterProvider> editorPane; private UITableEditorPane<ParameterProvider> editorPane;
public ReportletParameterViewPane() { public ReportletParameterViewPane() {
this(null, ParameterTableModel.NO_CHART_USE); this(null, ParameterTableModel.NO_CHART_USE);
} }
// kunsnat: 控制是否用Chart的热点链接actions // kunsnat: 控制是否用Chart的热点链接actions
public ReportletParameterViewPane(int useParaType) { public ReportletParameterViewPane(int useParaType) {
this(null, useParaType); this(null, useParaType);
} }
public ReportletParameterViewPane(UITableEditAction[] actions, int useParaType) { public ReportletParameterViewPane(UITableEditAction[] actions, int useParaType) {
this(actions, useParaType, ValueEditorPaneFactory.createVallueEditorPaneWithUseType(useParaType), this(actions, useParaType, ValueEditorPaneFactory.createVallueEditorPaneWithUseType(useParaType),
ValueEditorPaneFactory.createVallueEditorPaneWithUseType(useParaType)); ValueEditorPaneFactory.createVallueEditorPaneWithUseType(useParaType));
} }
public ReportletParameterViewPane(int useParaType, ValueEditorPane valueEditorPane, ValueEditorPane valueRenderPane) { public ReportletParameterViewPane(int useParaType, ValueEditorPane valueEditorPane, ValueEditorPane valueRenderPane) {
this(null, useParaType, valueEditorPane, valueRenderPane); this(null, useParaType, valueEditorPane, valueRenderPane);
} }
public ReportletParameterViewPane(UITableEditAction[] actions, int useParaType, ValueEditorPane valueEditorPane, ValueEditorPane valueRenderPane) { public ReportletParameterViewPane(UITableEditAction[] actions, int useParaType, ValueEditorPane valueEditorPane, ValueEditorPane valueRenderPane) {
this.initComponent(actions, useParaType, valueEditorPane, valueRenderPane); this.initComponent(actions, useParaType, valueEditorPane, valueRenderPane);
} }
/** /**
* 初始化组件 * 初始化组件
* @param actions Chart的热点链接actions *
* @param useParaType 类型 * @param actions Chart的热点链接actions
* @param useParaType 类型
*/ */
public void initComponent(final UITableEditAction[] actions, int useParaType, ValueEditorPane valueEditorPane, ValueEditorPane valueRenderPane) { public void initComponent(final UITableEditAction[] actions, int useParaType, ValueEditorPane valueEditorPane, ValueEditorPane valueRenderPane) {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
if (useParaType != ParameterTableModel.NO_CHART_USE) { if (useParaType != ParameterTableModel.NO_CHART_USE) {
ParameterTableModel model = new ParameterTableModel(valueEditorPane, valueRenderPane, this) { ParameterTableModel model = new ParameterTableModel(valueEditorPane, valueRenderPane, this) {
@Override @Override
public UITableEditAction[] createAction() { public UITableEditAction[] createAction() {
UITableEditAction[] tableEditActions = new UITableEditAction[] { new AddChartParameterAction(), new DeleteAction(this.component), UITableEditAction[] tableEditActions = new UITableEditAction[]{new AddChartParameterAction(), new DeleteAction(this.component),
new MoveUpAction(), new MoveDownAction() }; new MoveUpAction(), new MoveDownAction()};
return (UITableEditAction[]) ArrayUtils.addAll(tableEditActions, actions); return (UITableEditAction[]) ArrayUtils.addAll(tableEditActions, actions);
} }
}; };
editorPane = new UITableEditorPane<ParameterProvider>(model); editorPane = new UITableEditorPane<ParameterProvider>(model);
} else { } else {
editorPane = new UITableEditorPane<ParameterProvider>(new ParameterTableModel() { editorPane = new UITableEditorPane<ParameterProvider>(new ParameterTableModel() {
@Override @Override
public UITableEditAction[] createAction() { public UITableEditAction[] createAction() {
return (UITableEditAction[]) ArrayUtils.addAll(super.createAction(), actions); return (UITableEditAction[]) ArrayUtils.addAll(super.createAction(), actions);
} }
}); });
} }
this.add(editorPane, BorderLayout.CENTER); this.add(editorPane, BorderLayout.CENTER);
} }
/** /**
* 增加事件监听 * 增加事件监听
* @param l 加的东东 *
* @param l 加的东东
*/ */
public void addTableEditorListener(TableModelListener l) { public void addTableEditorListener(TableModelListener l) {
editorPane.addTableListener(l); editorPane.addTableListener(l);
} }
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Inter.getLocText("Parameters"); return Inter.getLocText("Parameters");
} }
public void populate(ParameterProvider[] parameters) { public void populate(ParameterProvider[] parameters) {
if (parameters == null) { if (parameters == null) {
return; return;
} }
editorPane.populate(parameters); editorPane.populate(parameters);
} }
public void populate(KV[] kv) { public void populate(KV[] kv) {
if (kv == null) { if (kv == null) {
return; return;
} }
Parameter[] parameters = new Parameter[kv.length]; Parameter[] parameters = new Parameter[kv.length];
for (int i = 0; i < kv.length; i++) { for (int i = 0; i < kv.length; i++) {
parameters[i] = new Parameter(kv[i].getKey(), kv[i].getValue()); parameters[i] = new Parameter(kv[i].getKey(), kv[i].getValue());
} }
this.populate(parameters); this.populate(parameters);
} }
public List<ParameterProvider> update() { public List<ParameterProvider> update() {
return editorPane.update(); return editorPane.update();
} }
public void update(List list) {
editorPane.update(list);
}
/** /**
* 更新 * 更新
* @return 数组 *
* @return 数组
*/ */
public KV[] updateKV() { public KV[] updateKV() {
List<ParameterProvider> list = this.update(); List<ParameterProvider> list = this.update();
int length = list.size(); int length = list.size();
KV[] kv = new KV[length]; KV[] kv = new KV[length];
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
kv[i] = new KV(); kv[i] = new KV();
kv[i].setKey(list.get(i).getName()); kv[i].setKey(list.get(i).getName());
kv[i].setValue( list.get(i).getValue()); kv[i].setValue(list.get(i).getValue());
} }
return kv; return kv;
} }
} }

1
designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java

@ -52,6 +52,7 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI {
private void initComponents(boolean isEditor) { private void initComponents(boolean isEditor) {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel buildWayPanel= FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane(); JPanel buildWayPanel= FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane();
buildWayPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
UILabel buildWayLabel = new UILabel(Inter.getLocText("FR-Designer_Build-Way") + " :"); UILabel buildWayLabel = new UILabel(Inter.getLocText("FR-Designer_Build-Way") + " :");
buildWayPanel.add(buildWayLabel); buildWayPanel.add(buildWayLabel);
buildBox = new UIComboBox(buildWay); buildBox = new UIComboBox(buildWay);

2
designer_base/src/com/fr/design/gui/frpane/UITabbedPaneUI.java

@ -30,7 +30,7 @@ public class UITabbedPaneUI extends BasicTabbedPaneUI {
private int addY = -1; private int addY = -1;
private int rollover = -1; private int rollover = -1;
private Color tabBorderColor = new Color(143, 160, 183); private Color tabBorderColor = new Color(143, 160, 183);
private Color[] tabSelectedColor = {new Color(255, 199, 59), new Color(187, 142, 33), new Color(214, 191, 137)}; private Color[] tabSelectedColor = {UIConstants.NORMAL_BLUE, new Color(187, 142, 33), new Color(214, 191, 137)};
/** /**
* 创建UI对象 * 创建UI对象

3
designer_base/src/com/fr/design/gui/ibutton/UIButtonGroup.java

@ -153,14 +153,13 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
} }
protected void initButton(UIToggleButton labelButton) { protected void initButton(UIToggleButton labelButton) {
labelButton.setRoundBorder(true);
labelButton.setBorderPainted(false); labelButton.setBorderPainted(false);
labelButtonList.add(labelButton); labelButtonList.add(labelButton);
this.add(labelButton); this.add(labelButton);
} }
protected Border getGroupBorder() { protected Border getGroupBorder() {
return BorderFactory.createEmptyBorder(1, 1, 1, 1); return BorderFactory.createEmptyBorder(0, 0, 0, 0);
} }
protected LayoutManager getGridLayout(int number) { protected LayoutManager getGridLayout(int number) {

2
designer_base/src/com/fr/design/gui/ibutton/UIRadioButton.java

@ -43,6 +43,4 @@ public class UIRadioButton extends JRadioButton {
public UIRadioButton(String text, Icon icon, boolean selected) { public UIRadioButton(String text, Icon icon, boolean selected) {
super(text, icon, selected); super(text, icon, selected);
} }
} }

106
designer_base/src/com/fr/design/gui/itableeditorpane/UITableEditorPane.java

@ -1,12 +1,12 @@
package com.fr.design.gui.itableeditorpane; package com.fr.design.gui.itableeditorpane;
import com.fr.design.constants.UIConstants;
import com.fr.design.border.UIRoundedBorder; import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.dialog.BasicPane;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*; import javax.swing.*;
@ -21,14 +21,14 @@ import java.util.List;
* @since 2012-3-28下午3:06:30 * @since 2012-3-28下午3:06:30
*/ */
public class UITableEditorPane<T> extends BasicPane { public class UITableEditorPane<T> extends BasicPane {
/** /**
* *
*/ */
private static final long serialVersionUID = 6855793816972735815L; private static final long serialVersionUID = 6855793816972735815L;
private JTable editTable; private JTable editTable;
// 放置action 的按钮. // 放置action 的按钮.
private UITableModelAdapter<T> tableModel; private UITableModelAdapter<T> tableModel;
private String leftLabelName; private String leftLabelName;
private JPanel buttonPane; private JPanel buttonPane;
public UITableEditorPane(UITableModelAdapter<T> model) { public UITableEditorPane(UITableModelAdapter<T> model) {
@ -49,9 +49,10 @@ public class UITableEditorPane<T> extends BasicPane {
UILabel l = new UILabel(leftLabelName); UILabel l = new UILabel(leftLabelName);
editTable = tableModel.createTable(); editTable = tableModel.createTable();
editTable.getTableHeader().setBackground(UIConstants.DEFAULT_BG_RULER);
UIScrollPane scrollPane = new UIScrollPane(editTable); UIScrollPane scrollPane = new UIScrollPane(editTable);
scrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC)); scrollPane.setBorder(new UIRoundedBorder(UIConstants.TITLED_BORDER_COLOR, 1, UIConstants.ARC));
pane.add(scrollPane, BorderLayout.CENTER); pane.add(scrollPane, BorderLayout.CENTER);
initbuttonPane(action); initbuttonPane(action);
JPanel controlPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel controlPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
@ -65,7 +66,7 @@ public class UITableEditorPane<T> extends BasicPane {
return tableModel; return tableModel;
} }
private void initbuttonPane(UITableEditAction[] action){ private void initbuttonPane(UITableEditAction[] action) {
buttonPane = new JPanel(); buttonPane = new JPanel();
if (action != null) { if (action != null) {
@ -87,54 +88,61 @@ public class UITableEditorPane<T> extends BasicPane {
/** /**
* 增加事件监听 * 增加事件监听
* @param l 加的东东 *
* @param l 加的东东
*/ */
public void addTableListener(TableModelListener l) { public void addTableListener(TableModelListener l) {
tableModel.addTableModelListener(l); tableModel.addTableModelListener(l);
} }
/** /**
* 移除事件监听 * 移除事件监听
* @param l 去的东东 *
* @param l 去的东东
*/ */
public void removeTableListener(TableModelListener l) { public void removeTableListener(TableModelListener l) {
tableModel.removeTableModelListener(l); tableModel.removeTableModelListener(l);
} }
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Inter.getLocText("TableData_Dynamic_Parameter_Setting"); return Inter.getLocText("TableData_Dynamic_Parameter_Setting");
} }
public void populate(T[] objs) { public void populate(T[] objs) {
tableModel.clear(); tableModel.clear();
if(objs==null){ if (objs == null) {
return; return;
} }
for (T obj : objs) { for (T obj : objs) {
tableModel.addRow(obj); tableModel.addRow(obj);
} }
this.tableModel.fireTableDataChanged(); this.tableModel.fireTableDataChanged();
if (objs.length > 0) { if (objs.length > 0) {
this.editTable.getSelectionModel().setSelectionInterval(0, 0); this.editTable.getSelectionModel().setSelectionInterval(0, 0);
} }
} }
// TODO:august这个最好还是返回数组 // TODO:august这个最好还是返回数组
public List<T> update() { public List<T> update() {
tableModel.stopCellEditing(); tableModel.stopCellEditing();
return tableModel.getList(); return tableModel.getList();
} }
public int getSelectedRow() { public void update(List list) {
return this.editTable.getSelectedRow(); tableModel.stopCellEditing();
} tableModel.setList(list);
}
public int getSelectedColumn() { public int getSelectedRow() {
return this.editTable.getSelectedColumn(); return this.editTable.getSelectedRow();
} }
public int getSelectedColumn() {
return this.editTable.getSelectedColumn();
}
public JPanel getbuttonPane(){ public JPanel getbuttonPane() {
return buttonPane; return buttonPane;
} }

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

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

3
designer_base/src/com/fr/design/gui/itextfield/UITextFieldUI.java

@ -51,9 +51,6 @@ public class UITextFieldUI extends BasicTextFieldUI {
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
g2d.clip(roundShape); g2d.clip(roundShape);
g2d.setColor(backgroundColor); g2d.setColor(backgroundColor);
if(!textField.isEnabled()){
g2d.setColor(UIConstants.NORMAL_BACKGROUND);
}
g2d.fillRoundRect(1, 1, width - 2, height - 2, 0, 0); g2d.fillRoundRect(1, 1, width - 2, height - 2, 0, 0);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF);
} }

54
designer_base/src/com/fr/design/gui/itree/refreshabletree/TreeRootPane.java

@ -9,7 +9,6 @@ import javax.swing.JPanel;
import com.fr.data.impl.TreeAttr; import com.fr.data.impl.TreeAttr;
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.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -18,10 +17,10 @@ public class TreeRootPane extends BasicPane {
// 是否支持多选(checkBoxTree) // 是否支持多选(checkBoxTree)
//private JCheckBox multipleSelection; //private JCheckBox multipleSelection;
private UIComboBox checkTypeComboBox; private UICheckBox checkTypeCheckBox;
// richer:加载的方式,支持异步加载和完全加载 // richer:加载的方式,支持异步加载和完全加载
private UIComboBox loadTypeComboBox; private UICheckBox loadTypeCheckBox;
private UICheckBox layerTypeCheckBox; private UICheckBox layerTypeCheckBox;
@ -30,32 +29,35 @@ public class TreeRootPane extends BasicPane {
public TreeRootPane() { public TreeRootPane() {
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
JPanel checkTypePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel checkTypePane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane_First0();
checkTypePane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); checkTypePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
checkTypePane.add(new UILabel(Inter.getLocText("Tree-Mutiple_Selection_Or_Not") + ":")); checkTypeCheckBox = new UICheckBox(Inter.getLocText("Tree-Mutiple_Selection_Or_Not"));
checkTypeComboBox = new UIComboBox(new String[] {Inter.getLocText("Yes"), Inter.getLocText("No")}); checkTypeCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
checkTypePane.add(checkTypeComboBox);
checkTypePane.add(checkTypeCheckBox);
this.add(checkTypePane); this.add(checkTypePane);
JPanel loadTypePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel loadTypePane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane_First0();
loadTypePane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); checkTypePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
loadTypePane.add(new UILabel(Inter.getLocText("Widget-Load_Type") + ":")); loadTypeCheckBox = new UICheckBox(Inter.getLocText("Widget-Load_By_Async"));
loadTypeComboBox = new UIComboBox(new String[]{Inter.getLocText("Widget-Load_By_Async"), Inter.getLocText("Widget-Load_By_Complete")}); loadTypeCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
loadTypePane.add(loadTypeComboBox);
loadTypePane.add(loadTypeCheckBox);
this.add(loadTypePane); this.add(loadTypePane);
JPanel leafSelectPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel leafSelectPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane_First0();
leafSelectPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); checkTypePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
leafSelectPane.add(layerTypeCheckBox = new UICheckBox(Inter.getLocText("Tree-Select_Leaf_Only"))); leafSelectPane.add(layerTypeCheckBox = new UICheckBox(Inter.getLocText("Tree-Select_Leaf_Only")));
UILabel tips = new UILabel(Inter.getLocText("Tree-Select_Leaf_Only_Tips")); layerTypeCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
tips.setForeground(new Color(147, 178, 233));
leafSelectPane.add(tips);
this.add(leafSelectPane); this.add(leafSelectPane);
JPanel returnFullPathPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel returnFullPathPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane_First0();
returnFullPathPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); checkTypePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
returnFullPathPane.add(returnFullPathCheckBox = new UICheckBox(Inter.getLocText("Tree-Return_Full_Path"))); returnFullPathPane.add(returnFullPathCheckBox = new UICheckBox(Inter.getLocText("Tree-Return_Full_Path")));
this.add(returnFullPathPane); returnFullPathCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
this.add(returnFullPathPane);
} }
@ -65,16 +67,16 @@ public class TreeRootPane extends BasicPane {
} }
public void populate(TreeAttr treeAttr) { public void populate(TreeAttr treeAttr) {
checkTypeComboBox.setSelectedIndex(treeAttr.isMultipleSelection() ? 0 : 1); checkTypeCheckBox.setSelected(treeAttr.isMultipleSelection());
loadTypeComboBox.setSelectedIndex(treeAttr.isAjax() ? 0 : 1); loadTypeCheckBox.setSelected(treeAttr.isAjax());
layerTypeCheckBox.setSelected(treeAttr.isSelectLeafOnly()); layerTypeCheckBox.setSelected(treeAttr.isSelectLeafOnly());
returnFullPathCheckBox.setSelected(treeAttr.isReturnFullPath()); returnFullPathCheckBox.setSelected(treeAttr.isReturnFullPath());
} }
public TreeAttr update() { public TreeAttr update() {
TreeAttr treeAttr = new TreeAttr(); TreeAttr treeAttr = new TreeAttr();
treeAttr.setMultipleSelection(checkTypeComboBox.getSelectedIndex() == 0); treeAttr.setMultipleSelection(checkTypeCheckBox.isSelected());
treeAttr.setAjax(loadTypeComboBox.getSelectedIndex() == 0); treeAttr.setAjax(loadTypeCheckBox.isSelected());
treeAttr.setSelectLeafOnly(layerTypeCheckBox.isSelected()); treeAttr.setSelectLeafOnly(layerTypeCheckBox.isSelected());
treeAttr.setReturnFullPath(returnFullPathCheckBox.isSelected()); treeAttr.setReturnFullPath(returnFullPathCheckBox.isSelected());

15
designer_base/src/com/fr/design/gui/style/FRFontPane.java

@ -300,14 +300,15 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
private JPanel createLeftPane() { private JPanel createLeftPane() {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {f}; double[] columnSize = {p};
double[] rowSize = {p, p, p}; double[] rowSize = {p, p, p};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{fontSizeStyleComboBox}, new Component[]{fontSizeStyleComboBox},
new Component[]{buttonPane}, new Component[]{buttonPane},
new Component[]{createLinePane()} new Component[]{createLinePane()}
}; };
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
} }
private JPanel createRightPane() { private JPanel createRightPane() {
@ -315,18 +316,20 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {f}; double[] columnSize = {f};
double[] rowSize = {p, p}; double[] rowSize = {p, p};
int[][] rowCount = {{1, 1}, {1, 1}};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{fontSizeComboBox}, new Component[]{fontSizeComboBox},
new Component[]{isSuperOrSubPane} new Component[]{isSuperOrSubPane}
}; };
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
} }
private JPanel createPane() { private JPanel createPane() {
JPanel createPane = new JPanel(new BorderLayout(3, 5)); JPanel createPane = new JPanel(new BorderLayout());
createPane.add(fontNameComboBox, BorderLayout.NORTH); createPane.add(fontNameComboBox, BorderLayout.NORTH);
createPane.add(createLeftPane(), BorderLayout.CENTER); JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{createLeftPane(), createRightPane()}}, TableLayoutHelper.FILL_LASTCOLUMN, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_LARGE);
createPane.add(createRightPane(), BorderLayout.EAST); jPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
createPane.add(jPanel, BorderLayout.CENTER);
return createPane; return createPane;
} }

40
designer_base/src/com/fr/design/gui/style/FormatPane.java

@ -42,6 +42,7 @@ public class FormatPane extends AbstractBasicStylePane {
private static final int LABLE_DELTA_WIDTH = 8; private static final int LABLE_DELTA_WIDTH = 8;
private static final int LABLE_HEIGHT = 15; //标签背景的范围 private static final int LABLE_HEIGHT = 15; //标签背景的范围
private static final int CURRENCY_FLAG_POINT = 6; private static final int CURRENCY_FLAG_POINT = 6;
private static final Border LEFT_BORDER = BorderFactory.createEmptyBorder(0,30,0,0);
private static final Integer[] TYPES = new Integer[]{FormatContents.NULL, FormatContents.NUMBER, FormatContents.CURRENCY, FormatContents.PERCENT, FormatContents.SCIENTIFIC, private static final Integer[] TYPES = new Integer[]{FormatContents.NULL, FormatContents.NUMBER, FormatContents.CURRENCY, FormatContents.PERCENT, FormatContents.SCIENTIFIC,
FormatContents.DATE, FormatContents.TIME, FormatContents.TEXT}; FormatContents.DATE, FormatContents.TIME, FormatContents.TEXT};
@ -76,7 +77,7 @@ public class FormatPane extends AbstractBasicStylePane {
contentPane = new JPanel(new BorderLayout(0, 4)) { contentPane = new JPanel(new BorderLayout(0, 4)) {
@Override @Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
return new Dimension(super.getPreferredSize().width, 70); return new Dimension(super.getPreferredSize().width, 65);
} }
}; };
typeComboBox = new UIComboBox(types); typeComboBox = new UIComboBox(types);
@ -84,37 +85,44 @@ public class FormatPane extends AbstractBasicStylePane {
typeComboBox.setRenderer(render); typeComboBox.setRenderer(render);
typeComboBox.addItemListener(itemListener); typeComboBox.addItemListener(itemListener);
contentPane.add(sampleLabel, BorderLayout.NORTH); contentPane.add(sampleLabel, BorderLayout.NORTH);
centerPane = new JPanel(new CardLayout());
centerPane.add(new JPanel(), "hide"); txtCenterPane = new JPanel(new BorderLayout());
centerPane.setPreferredSize(new Dimension(0, 0));
centerPane.add(contentPane, "show");
formatFontPane = new JPanel(new BorderLayout());
formatFontPane.add(centerPane, BorderLayout.NORTH);
formatFontPane.add(new FRFontPane(), BorderLayout.CENTER);
txtCenterPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
contentPane.add(txtCenterPane, BorderLayout.CENTER);
textField = new UIComboBox(FormatField.getInstance().getFormatArray(getFormatContents())); textField = new UIComboBox(FormatField.getInstance().getFormatArray(getFormatContents()));
textField.addItemListener(textFieldItemListener); textField.addItemListener(textFieldItemListener);
textField.setEditable(true); textField.setEditable(true);
txtCenterPane.add(textField, BorderLayout.NORTH); txtCenterPane.add(textField, BorderLayout.NORTH);
contentPane.add(txtCenterPane, BorderLayout.CENTER);
centerPane = new JPanel(new CardLayout());
centerPane.add(new JPanel(), "hide");
centerPane.setPreferredSize(new Dimension(0, 0));
centerPane.add(contentPane, "show");
frFontPane = new FRFontPane(); frFontPane = new FRFontPane();
UILabel font = new UILabel(Inter.getLocText("FR-Designer_FRFont"), SwingConstants.LEFT); UILabel font = new UILabel(Inter.getLocText("FR-Designer_FRFont"), SwingConstants.LEFT);
JPanel fontPane = new JPanel(new BorderLayout()); JPanel fontPane = new JPanel(new BorderLayout());
fontPane.add(font, BorderLayout.NORTH); fontPane.add(font, BorderLayout.NORTH);
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
typeComboBox.setPreferredSize(new Dimension(155,20));
JPanel typePane = new JPanel(new BorderLayout());
typePane.add(typeComboBox, BorderLayout.CENTER);
typePane.setBorder(LEFT_BORDER);
centerPane.setBorder(LEFT_BORDER);
frFontPane.setBorder(LEFT_BORDER);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null, null}, new Component[]{null, null},
new Component[]{new UILabel(Inter.getLocText("FR-Base_Format") + " ", SwingConstants.LEFT), typeComboBox}, new Component[]{new UILabel(Inter.getLocText("FR-Base_Format"), SwingConstants.LEFT), typePane},
new Component[]{null, centerPane}, new Component[]{null, centerPane},
new Component[]{fontPane, frFontPane}, new Component[]{fontPane, frFontPane},
new Component[]{null, null}
}; };
double[] rowSize = {p, p, p, p, p}; double[] rowSize = {p, p, p, p, p};
double[] columnSize = {p, f}; double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 3}, {1, 1}}; int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM); JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM);
this.add(panel, BorderLayout.CENTER); this.add(panel, BorderLayout.CENTER);
} }
@ -310,7 +318,7 @@ public class FormatPane extends AbstractBasicStylePane {
for (int i = 0; i < items.length; i++) { for (int i = 0; i < items.length; i++) {
textField.addItem(items[i]); textField.addItem(items[i]);
} }
centerPane.setPreferredSize(new Dimension(270, 70)); centerPane.setPreferredSize(new Dimension(270, 65));
cardLayout.show(centerPane, "show"); cardLayout.show(centerPane, "show");
} }
isFormat = true; isFormat = true;

BIN
designer_base/src/com/fr/design/images/arrow/arrow_down.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 B

After

Width:  |  Height:  |  Size: 278 B

BIN
designer_base/src/com/fr/design/images/arrow/arrow_up.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 216 B

After

Width:  |  Height:  |  Size: 311 B

BIN
designer_base/src/com/fr/design/images/buttonicon/add.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 453 B

After

Width:  |  Height:  |  Size: 160 B

BIN
designer_base/src/com/fr/design/images/buttonicon/add_press.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 306 B

BIN
designer_base/src/com/fr/design/images/buttonicon/addicon.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 216 B

After

Width:  |  Height:  |  Size: 232 B

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save