Browse Source

Merge remote-tracking branch 'upstream/9.0' into 9.0

master
MoMeak 7 years ago
parent
commit
5833806cbb
  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. 38
      designer/src/com/fr/design/actions/insert/cell/AbstractCellAction.java
  5. 17
      designer/src/com/fr/design/actions/insert/cell/BiasCellAction.java
  6. 14
      designer/src/com/fr/design/actions/insert/cell/ChartCellAction.java
  7. 16
      designer/src/com/fr/design/actions/insert/cell/DSColumnCellAction.java
  8. 16
      designer/src/com/fr/design/actions/insert/cell/FormulaCellAction.java
  9. 16
      designer/src/com/fr/design/actions/insert/cell/GeneralCellAction.java
  10. 16
      designer/src/com/fr/design/actions/insert/cell/ImageCellAction.java
  11. 93
      designer/src/com/fr/design/actions/insert/cell/RichTextCellAction.java
  12. 99
      designer/src/com/fr/design/actions/insert/cell/SubReportCellAction.java
  13. 4
      designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java
  14. 3
      designer/src/com/fr/design/mainframe/CellWidgetPropertyPane.java
  15. 4
      designer/src/com/fr/design/module/DesignerModule.java
  16. 1
      designer/src/com/fr/design/widget/WidgetPane.java
  17. 1
      designer/src/com/fr/design/widget/ui/ButtonDefinePane.java
  18. 12
      designer/src/com/fr/design/widget/ui/CheckBoxGroupDefinePane.java
  19. 213
      designer/src/com/fr/design/widget/ui/DateEditorDefinePane.java
  20. 7
      designer/src/com/fr/design/widget/ui/btn/AppendRowButtonDefinePane.java
  21. 9
      designer/src/com/fr/design/widget/ui/btn/DefineAppendColumnRowPane.java
  22. 25
      designer/src/com/fr/design/widget/ui/btn/DefineDeleteColumnRowPane.java
  23. 7
      designer/src/com/fr/design/widget/ui/btn/DeleteRowButtonDefinePane.java
  24. 20
      designer/src/com/fr/design/widget/ui/btn/FreeButtonDetailPane.java
  25. 199
      designer/src/com/fr/quickeditor/CellQuickEditor.java
  26. 2
      designer/src/com/fr/quickeditor/ChartQuickEditor.java
  27. 18
      designer/src/com/fr/quickeditor/cellquick/CellBiasTextPainterEditor.java
  28. 47
      designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java
  29. 82
      designer/src/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java
  30. 18
      designer/src/com/fr/quickeditor/cellquick/CellImageQuickEditor.java
  31. 18
      designer/src/com/fr/quickeditor/cellquick/CellRichTextEditor.java
  32. 55
      designer/src/com/fr/quickeditor/cellquick/CellStringQuickEditor.java
  33. 18
      designer/src/com/fr/quickeditor/cellquick/CellSubReportEditor.java
  34. 42
      designer_base/src/com/fr/design/actions/TemplateComponentAction.java
  35. 34
      designer_base/src/com/fr/design/actions/core/ActionFactory.java
  36. 4
      designer_base/src/com/fr/design/border/UITitledBorder.java
  37. 6
      designer_base/src/com/fr/design/constants/UIConstants.java
  38. 0
      designer_base/src/com/fr/design/designer/properties/Decoder.java
  39. 18
      designer_base/src/com/fr/design/designer/properties/Encoder.java
  40. 6
      designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java
  41. 16
      designer_base/src/com/fr/design/gui/frpane/RegPane.java
  42. 63
      designer_base/src/com/fr/design/gui/itableeditorpane/UITableEditorPane.java
  43. 13
      designer_base/src/com/fr/design/gui/itextfield/UITextField.java
  44. 3
      designer_base/src/com/fr/design/gui/itextfield/UITextFieldUI.java
  45. 6
      designer_base/src/com/fr/design/gui/style/FRFontPane.java
  46. 5
      designer_base/src/com/fr/design/javascript/EmailPane.java
  47. 5
      designer_base/src/com/fr/design/javascript/JavaScriptImplPane.java
  48. 3
      designer_base/src/com/fr/design/mainframe/widget/BasicPropertyPane.java
  49. 4
      designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleBackgroundEditor.java
  50. 80
      designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleDictionaryEditor.java
  51. 80
      designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleEditor.java
  52. 8
      designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleIconEditor.java
  53. 388
      designer_base/src/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java
  54. 98
      designer_base/src/com/fr/design/mainframe/widget/accessibles/RendererField.java
  55. 44
      designer_base/src/com/fr/design/mainframe/widget/accessibles/UneditableAccessibleEditor.java
  56. 2
      designer_base/src/com/fr/design/mainframe/widget/editors/DataBindingEditor.java
  57. 0
      designer_base/src/com/fr/design/mainframe/widget/editors/ITextComponent.java
  58. 0
      designer_base/src/com/fr/design/mainframe/widget/editors/TextField.java
  59. 186
      designer_base/src/com/fr/design/mainframe/widget/renderer/GenericCellRenderer.java
  60. 13
      designer_base/src/com/fr/design/mainframe/widget/renderer/IconCellRenderer.java
  61. 0
      designer_base/src/com/fr/design/mainframe/widget/wrappers/BackgroundWrapper.java
  62. 0
      designer_base/src/com/fr/design/mainframe/widget/wrappers/DictionaryWrapper.java
  63. 0
      designer_base/src/com/fr/design/mainframe/widget/wrappers/IconWrapper.java
  64. 9
      designer_base/src/com/fr/design/menu/ToolBarDef.java
  65. 3
      designer_base/src/com/fr/design/scrollruler/ModLineBorder.java
  66. 2
      designer_base/src/com/fr/design/utils/gui/GUIPaintUtils.java
  67. 3
      designer_base/src/com/fr/design/widget/DataModify.java
  68. 19
      designer_base/src/com/fr/design/widget/WidgetBoundsPaneFactory.java
  69. 2
      designer_base/src/com/fr/design/widget/btn/ButtonDetailPane.java
  70. 40
      designer_base/src/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java
  71. 28
      designer_base/src/com/fr/design/widget/component/BackgroundCompPane.java
  72. 48
      designer_base/src/com/fr/design/widget/component/ButtonBackgroundPane.java
  73. 81
      designer_base/src/com/fr/design/widget/component/DateValuePane.java
  74. 6
      designer_base/src/com/fr/start/BaseDesigner.java
  75. 4
      designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperRelateFloatLinkPane.java
  76. 12
      designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleWLayoutBorderStyleEditor.java
  77. 1
      designer_form/src/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java
  78. 19
      designer_form/src/com/fr/design/parameter/RootDesignDefinePane.java
  79. 2
      designer_form/src/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java
  80. 10
      designer_form/src/com/fr/design/widget/ui/designer/ButtonDefinePane.java
  81. 16
      designer_form/src/com/fr/design/widget/ui/designer/ButtonGroupDictPane.java
  82. 6
      designer_form/src/com/fr/design/widget/ui/designer/CheckBoxDefinePane.java
  83. 3
      designer_form/src/com/fr/design/widget/ui/designer/CheckBoxGroupDefinePane.java
  84. 4
      designer_form/src/com/fr/design/widget/ui/designer/ComboBoxDefinePane.java
  85. 3
      designer_form/src/com/fr/design/widget/ui/designer/ComboCheckBoxDefinePane.java
  86. 3
      designer_form/src/com/fr/design/widget/ui/designer/CustomWritableRepeatEditorPane.java
  87. 201
      designer_form/src/com/fr/design/widget/ui/designer/DateEditorDefinePane.java
  88. 5
      designer_form/src/com/fr/design/widget/ui/designer/DirectWriteEditorDefinePane.java
  89. 12
      designer_form/src/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java
  90. 20
      designer_form/src/com/fr/design/widget/ui/designer/FreeButtonDefinePane.java
  91. 6
      designer_form/src/com/fr/design/widget/ui/designer/LabelDefinePane.java
  92. 7
      designer_form/src/com/fr/design/widget/ui/designer/MultiFileEditorPane.java
  93. 222
      designer_form/src/com/fr/design/widget/ui/designer/NumberEditorDefinePane.java
  94. 13
      designer_form/src/com/fr/design/widget/ui/designer/TextFieldEditorDefinePane.java
  95. 2
      designer_form/src/com/fr/design/widget/ui/designer/TreeEditorDefinePane.java
  96. 64
      designer_form/src/com/fr/design/widget/ui/designer/btn/ButtonDetailPaneFactory.java
  97. 2
      designer_form/src/com/fr/design/widget/ui/designer/btn/ButtonGroupDefinePane.java
  98. 143
      designer_form/src/com/fr/design/widget/ui/designer/btn/ButtonSytleDefinedPane.java
  99. 30
      designer_form/src/com/fr/design/widget/ui/designer/btn/DefaultButtonDetailPane.java
  100. 56
      designer_form/src/com/fr/design/widget/ui/designer/btn/DefaultButtonStylePane.java
  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;
public abstract class CellSelectionAction extends ElementCaseAction {
protected CellSelectionAction(ElementCasePane t) {
super(t);
}
@Override
public boolean executeActionReturnUndoRecordNeeded() {
ElementCasePane ePane = this.getEditingComponent();
Selection s = ePane.getSelection();
// TODO ALEX_SEP instanceof i hate it
if (s instanceof CellSelection) {
return executeActionReturnUndoRecordNeededWithCellSelection((CellSelection)s);
}
return false;
}
protected abstract boolean executeActionReturnUndoRecordNeededWithCellSelection(CellSelection cs);
@Override
public void update() {
super.update();
if (this.isEnabled()) {
this.setEnabled(this.getEditingComponent().getSelection() instanceof CellSelection);
}
}
protected CellSelectionAction() {
}
protected CellSelectionAction(ElementCasePane t) {
super(t);
}
@Override
public boolean executeActionReturnUndoRecordNeeded() {
ElementCasePane ePane = this.getEditingComponent();
Selection s = ePane.getSelection();
// TODO ALEX_SEP instanceof i hate it
if (s instanceof CellSelection) {
return executeActionReturnUndoRecordNeededWithCellSelection((CellSelection) s);
}
return false;
}
protected abstract boolean executeActionReturnUndoRecordNeededWithCellSelection(CellSelection cs);
@Override
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是否可以编辑,当然还可以做些其他事情
//
import com.fr.design.mainframe.DesignerContext;
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 {
protected ElementCaseAction(ElementCasePane t) {
super(t);
t.addSelectionChangeListener(createSelectionListener());
}
protected ElementCaseAction() {
}
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> {
protected SelectionListenerAction() {
}
protected SelectionListenerAction(ElementCasePane elementCasePane) {
super(elementCasePane);
}
protected SelectionListener createSelectionListener () {
protected SelectionListener createSelectionListener() {
return new SelectionListener() {
@Override

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

@ -13,12 +13,15 @@ import com.fr.report.elementcase.TemplateElementCase;
* Cell.
*/
public abstract class AbstractCellAction extends CellSelectionAction {
protected AbstractCellAction(ElementCasePane t) {
super(t);
}
protected AbstractCellAction() {
}
protected AbstractCellAction(ElementCasePane t) {
super(t);
}
public abstract Class getCellValueClass();
/*
* TODO ALEX_SEP 这里的返回boolean量表示模板是否改变,导致很多很多的方法的boolean返回值都是这个意思
*
@ -26,8 +29,8 @@ public abstract class AbstractCellAction extends CellSelectionAction {
*/
@Override
protected boolean executeActionReturnUndoRecordNeededWithCellSelection(
CellSelection cs) {
ElementCasePane ePane = this.getEditingComponent();
CellSelection cs) {
ElementCasePane ePane = this.getEditingComponent();
//got simple cell element from column and row.
TemplateElementCase report = ePane.getEditingElementCase();
@ -35,17 +38,18 @@ public abstract class AbstractCellAction extends CellSelectionAction {
if (report != null && this instanceof DSColumnCellAction) {
SheetUtils.calculateDefaultParent(report);
}
return ePane.getGrid().startCellEditingAt_DEC(
cs.getColumn(),
cs.getRow(),
this.getCellValueClass(), false
cs.getColumn(),
cs.getRow(),
this.getCellValueClass(), false
);
}
@Override
public void update() {
super.update();
ElementCasePane ePane = this.getEditingComponent();
this.setEnabled(ePane.isSelectedOneCell());
}
@Override
public void update() {
super.update();
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;
import javax.swing.KeyStroke;
import com.fr.base.BaseUtils;
import com.fr.design.actions.core.WorkBookSupportable;
import com.fr.design.mainframe.ElementCasePane;
@ -12,12 +10,23 @@ import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter;
import com.fr.report.cell.painter.BiasTextPainter;
import javax.swing.KeyStroke;
/**
* Bias
*/
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.setName(getMenuKeySet().getMenuKeySetName()+ "...");
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 ChartCellAction(){
initAction();
}
public ChartCellAction(ElementCasePane t) {
super(t);
this.setMenuKeySet(INSERT_CHART);
this.setName(getMenuKeySet().getMenuKeySetName()+ "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
initAction();
}
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"));
}

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;
public class DSColumnCellAction extends AbstractCellAction implements WorkBookSupportable {
public DSColumnCellAction(ElementCasePane t) {
super(t);
public DSColumnCellAction() {
initAction();
}
public DSColumnCellAction(ElementCasePane t) {
super(t);
initAction();
this.setSearchText(new DSColumnPane());
}
private void initAction() {
this.setMenuKeySet(KeySetUtils.INSERT_DATA_COLUMN);
this.setName(getMenuKeySet().getMenuKeySetName()+ "...");
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_insert/bindColumn.png"));
this.setSearchText(new DSColumnPane());
}
@Override

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

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

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

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

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

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

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

@ -279,8 +279,8 @@ public class SelectedDataColumnPane extends BasicPane {
});
}
private void initWithParameterButton(ElementCasePane casePane, TemplateCellElement cellElement) {
SelectedDataColumnPane that = this;
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() {

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

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

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

@ -169,7 +169,7 @@ public class DesignerModule extends DesignModule {
}
@Override
/**
/*
* 针对不同的对象在读取Object对象的xml的时候需要使用不同的对象生成器
* @return 返回对象生成器
*/
@ -242,7 +242,7 @@ public class DesignerModule extends DesignModule {
}
@Override
/**
/*
* 返回设计器能打开的模板类型的一个数组列表
* @return 可以打开的模板类型的数组
*/

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -1,27 +1,30 @@
package com.fr.quickeditor;
import com.fr.design.actions.utils.DeprecatedActionManager;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.gui.icombobox.UIComboBox;
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.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.CellElementPropertyPane;
import com.fr.design.mainframe.DesignerContext;
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.utils.gui.GUICoreUtils;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.grid.selection.CellSelection;
import com.fr.report.cell.TemplateCellElement;
import com.fr.stable.ColumnRow;
import javax.swing.*;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.*;
import java.util.ArrayList;
/**
* @author zhou, yaoh.wu
@ -30,22 +33,78 @@ import java.awt.event.MouseEvent;
*/
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 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));
}
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[]{createCenterBody(), null}
new Component[]{centerBody, null}
};
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
this.add(panel, BorderLayout.CENTER);
leftContentPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BarLayout());
this.add(scrollBar);
this.add(leftContentPane);
}
@ -58,33 +117,70 @@ public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
cellLabel.setPreferredSize(new Dimension(60, 20));
UILabel insertContentLabel = new UILabel(Inter.getLocText("HF-Insert_Content"));
insertContentLabel.setPreferredSize(new Dimension(60, 20));
UIButton cellElementEditButton = initCellElementEditButton();
UIComboBox cellElementEditButton = initCellElementEditComboBox();
Component[][] components = new Component[][]{
new Component[]{cellLabel, columnRowTextField = initColumnRowTextField()},
new Component[]{insertContentLabel, cellElementEditButton},
};
JPanel topContent = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
topContent.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
topContent.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
return topContent;
}
/**
* 初始化添加按钮
* TODO 9.0 换成下拉菜单后原来的快捷键不好处理先跳过
*
* @return UIButton
*/
private UIButton initCellElementEditButton() {
final UIButton cellElementEditButton = new UIButton(IOUtils.readIcon("/com/fr/design/images/buttonicon/add.png"));
cellElementEditButton.addMouseListener(new MouseAdapter() {
private UIComboBox initCellElementEditComboBox() {
final String[] items = getDefaultComboBoxItems();
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
public void mousePressed(MouseEvent evt) {
GUICoreUtils.showPopMenuWithParentWidth(DeprecatedActionManager.getCellMenu(tc).createJPopupMenu(), cellElementEditButton, 0, cellElementEditButton.getY() - 6);
public void popupMenuCanceled(PopupMenuEvent e) {
}
});
return cellElementEditButton;
comboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
selectedIndex = comboBox.getSelectedIndex();
cellInsertActions[selectedIndex].actionPerformed(e);
}
});
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()]);
}
/**
@ -130,6 +226,14 @@ public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
*/
public abstract JComponent createCenterBody();
/**
* 初始化下拉框中的类型
*
* @return JComponent 待显示的详细信息面板
*/
public abstract Object getComboBoxSelected();
/**
* 刷新
*/
@ -146,4 +250,55 @@ public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
* 刷新详细信息
*/
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;
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.gui.chart.BaseChartPropertyPane;
import com.fr.design.mainframe.ElementCasePane;

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

@ -1,11 +1,14 @@
package com.fr.quickeditor.cellquick;
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.dialog.DialogActionAdapter;
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.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.quickeditor.CellQuickEditor;
import com.fr.report.cell.painter.BiasTextPainter;
@ -23,8 +26,7 @@ public class CellBiasTextPainterEditor extends CellQuickEditor {
@Override
public JComponent createCenterBody() {
JPanel content = new JPanel(new BorderLayout());
content.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
UIButton editButton = new UIButton(Inter.getLocText("Edit"), IOUtils.readIcon("/com/fr/design/images/m_insert/bias.png"));
UIButton editButton = new UIButton(Inter.getLocText("Edit"));
editButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@ -32,10 +34,18 @@ public class CellBiasTextPainterEditor extends CellQuickEditor {
}
});
editButton.setOpaque(false);
content.add(editButton, BorderLayout.CENTER);
content.add(TableLayoutHelper.createTableLayoutPane(new Component[][]{
new Component[]{emptyLabel, editButton}},
new double[]{TableLayout.PREFERRED},
new double[]{TableLayout.PREFERRED, TableLayout.FILL}), BorderLayout.CENTER);
return content;
}
@Override
public Object getComboBoxSelected() {
return ActionFactory.createAction(BiasCellAction.class);
}
private void showEditingDialog() {
final BiasTextPainter oldbiasTextPainter = (BiasTextPainter) cellElement.getValue();
final BiasTextPainterPane biasTextPainterPane = new BiasTextPainterPane();

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

@ -2,6 +2,8 @@ package com.fr.quickeditor.cellquick;
import com.fr.base.Formula;
import com.fr.design.actions.columnrow.DSColumnConditionAction;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.insert.cell.DSColumnCellAction;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dscolumn.DSColumnAdvancedPane;
@ -133,7 +135,6 @@ public class CellDSColumnEditor extends CellQuickEditor {
String[] iconArray = new String[paneList.size()];
card = new CardLayout();
cardContainer = new JPanel(card);
cardContainer.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
for (int i = 0; i < paneList.size(); i++) {
CellEditorPane pane = paneList.get(i);
iconArray[i] = pane.getIconPath();
@ -225,9 +226,8 @@ public class CellDSColumnEditor extends CellQuickEditor {
new Component[]{uiLabel, uiButton}
};
conditionPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.add(this.createContentPane(), BorderLayout.CENTER);
this.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
}
@ -279,8 +279,6 @@ public class CellDSColumnEditor extends CellQuickEditor {
class DSColumnAdvancedEditorPane extends CellEditorPane {
private static final String INSET_TEXT = " ";
//排列顺序
private ResultSetSortConfigPane sortPane;
//结果集筛选
@ -293,14 +291,16 @@ public class CellDSColumnEditor extends CellQuickEditor {
private UICheckBox veCheckBox;
//补充空白数据
private UICheckBox useMultiplyNumCheckBox;
//补充空白数据目输入框
//补充空白数据目输入框
private UISpinner multiNumSpinner;
//补充空白数据数目面板 可隐藏
private JPanel multiPane;
public DSColumnAdvancedEditorPane() {
this.setLayout(new BorderLayout());
this.add(this.createContentPane(), BorderLayout.CENTER);
this.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
}
@ -323,13 +323,11 @@ public class CellDSColumnEditor extends CellQuickEditor {
filterPane.update(cellElement);
//更新单元格扩展属性
updateExtendConfig();
//更新补充空白设置
updateMultipleConfig();
}
}
@SuppressWarnings("Duplicates")
@Override
public void populate() {
if (cellElement != null) {
@ -373,7 +371,6 @@ public class CellDSColumnEditor extends CellQuickEditor {
/**
* 更新单元格扩展属性
*/
@SuppressWarnings("Duplicates")
private void updateExtendConfig() {
CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr();
if (cellExpandAttr == null) {
@ -458,7 +455,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
});
//可扩展性
JPanel extendableDirectionPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
JPanel extendableDirectionPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
extendableDirectionPane.add(heCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Horizontal_Extendable")));
extendableDirectionPane.add(veCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Vertical_Extendable")));
heCheckBox.addChangeListener(new ChangeListener() {
@ -476,13 +473,23 @@ public class CellDSColumnEditor extends CellQuickEditor {
}
});
JPanel multiNumPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
//补充空白数据
JPanel multiNumPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
useMultiplyNumCheckBox = new UICheckBox(Inter.getLocText("Column_Multiple"));
multiNumPane.add(useMultiplyNumCheckBox);
multiNumPane.add(new UILabel(INSET_TEXT));
useMultiplyNumCheckBox = new UICheckBox(Inter.getLocText("Fill_blank_Data"));
JPanel checkBoxPane = new JPanel(new BorderLayout());
checkBoxPane.add(useMultiplyNumCheckBox, BorderLayout.WEST);
multiNumPane.add(checkBoxPane);
multiNumSpinner = new UISpinner(1, 10000, 1, 1);
multiNumPane.add(multiNumSpinner);
//数据倍数
UILabel multipleLabel = new UILabel(Inter.getLocText("Column_Multiple"));
multipleLabel.setPreferredSize(new Dimension(60, 20));
multiPane = TableLayoutHelper.createTableLayoutPane(new Component[][]{
new Component[]{
multipleLabel, multiNumSpinner
}
}, new double[]{P}, new double[]{P, F}
);
multiNumPane.add(multiPane);
useMultiplyNumCheckBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
checkButtonEnabled();
@ -516,8 +523,10 @@ public class CellDSColumnEditor extends CellQuickEditor {
private void checkButtonEnabled() {
if (useMultiplyNumCheckBox.isSelected()) {
multiNumSpinner.setEnabled(true);
multiPane.setVisible(true);
} else {
multiNumSpinner.setEnabled(false);
multiPane.setVisible(false);
}
}
@ -586,6 +595,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
if (cellElement != null) {
Object value = cellElement.getValue();
if (value != null && value instanceof DSColumn) {
this.formulaField.populateElement(cellElement);
DSColumn dSColumn = (DSColumn) value;
int sort = dSColumn.getOrder();
this.sortTypePane.setSelectedIndex(sort);
@ -981,4 +991,9 @@ public class CellDSColumnEditor extends CellQuickEditor {
}
}
}
@Override
public Object getComboBoxSelected() {
return ActionFactory.createAction(DSColumnCellAction.class);
}
}

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

@ -3,7 +3,18 @@ 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;
@ -15,6 +26,8 @@ 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;
@ -27,7 +40,7 @@ import java.awt.event.KeyEvent;
*/
public class CellFormulaQuickEditor extends CellQuickEditor {
//文本域
private UITextField stringTextField;
private UITextField formulaTextField;
//编辑状态
private boolean isEditing = false;
@ -35,20 +48,23 @@ public class CellFormulaQuickEditor extends CellQuickEditor {
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(stringTextField.getText().trim());
changeReportPaneCell(formulaTextField.getText().trim());
}
@Override
public void removeUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim());
changeReportPaneCell(formulaTextField.getText().trim());
}
@Override
public void changedUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim());
changeReportPaneCell(formulaTextField.getText().trim());
}
};
@ -63,9 +79,8 @@ public class CellFormulaQuickEditor extends CellQuickEditor {
@Override
public JComponent createCenterBody() {
JPanel content = new JPanel(new BorderLayout());
content.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
stringTextField = new UITextField();
stringTextField.addKeyListener(new KeyAdapter() {
formulaTextField = new UITextField();
formulaTextField.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
if (tc != null) {
@ -73,8 +88,47 @@ public class CellFormulaQuickEditor extends CellQuickEditor {
}
}
});
content.add(stringTextField, BorderLayout.CENTER);
return content;
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.createTableLayoutPane(new Component[][]{
new Component[]{emptyLabel, content}},
new double[]{TableLayout.PREFERRED},
new double[]{TableLayout.PREFERRED, TableLayout.FILL});
}
@Override
public Object getComboBoxSelected() {
return ActionFactory.createAction(FormulaCellAction.class);
}
@ -105,7 +159,7 @@ public class CellFormulaQuickEditor extends CellQuickEditor {
}
}
fireTargetModified();
stringTextField.requestFocus();
formulaTextField.requestFocus();
isEditing = false;
}
@ -131,7 +185,7 @@ public class CellFormulaQuickEditor extends CellQuickEditor {
}
}
showText(str);
stringTextField.setEditable(tc.isSelectedOneCell());
formulaTextField.setEditable(tc.isSelectedOneCell());
}
/**
@ -144,9 +198,9 @@ public class CellFormulaQuickEditor extends CellQuickEditor {
if (isEditing) {
return;
}
stringTextField.getDocument().removeDocumentListener(documentListener);
stringTextField.setText(str);
stringTextField.getDocument().addDocumentListener(documentListener);
formulaTextField.getDocument().removeDocumentListener(documentListener);
formulaTextField.setText(str);
formulaTextField.getDocument().addDocumentListener(documentListener);
}
}

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

@ -1,12 +1,15 @@
package com.fr.quickeditor.cellquick;
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.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.report.SelectImagePane;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.quickeditor.CellQuickEditor;
import com.fr.report.cell.cellattr.CellImage;
@ -31,8 +34,7 @@ public class CellImageQuickEditor extends CellQuickEditor {
@Override
public JComponent createCenterBody() {
JPanel content = new JPanel(new BorderLayout());
content.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
UIButton editButton = new UIButton(Inter.getLocText("Edit"), IOUtils.readIcon("/com/fr/design/images/m_insert/image.png"));
UIButton editButton = new UIButton(Inter.getLocText("Edit"));
editButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@ -40,11 +42,13 @@ public class CellImageQuickEditor extends CellQuickEditor {
}
});
editButton.setOpaque(false);
content.add(editButton, BorderLayout.CENTER);
content.add(TableLayoutHelper.createTableLayoutPane(new Component[][]{
new Component[]{emptyLabel, editButton}},
new double[]{TableLayout.PREFERRED},
new double[]{TableLayout.PREFERRED, TableLayout.FILL}), BorderLayout.CENTER);
return content;
}
@SuppressWarnings("Duplicates")
private void showEditingDialog() {
final SelectImagePane imageEditorPane = new SelectImagePane();
imageEditorPane.populate(cellElement);
@ -68,4 +72,8 @@ public class CellImageQuickEditor extends CellQuickEditor {
}
@Override
public Object getComboBoxSelected() {
return ActionFactory.createAction(ImageCellAction.class);
}
}

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

@ -1,7 +1,10 @@
package com.fr.quickeditor.cellquick;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.insert.cell.RichTextCellAction;
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.quickeditor.CellQuickEditor;
@ -21,21 +24,28 @@ public class CellRichTextEditor extends CellQuickEditor {
super();
}
@SuppressWarnings("Duplicates")
@Override
public JComponent createCenterBody() {
JPanel content = new JPanel(new BorderLayout());
content.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
richTextButton = new UIButton();
richTextButton.setOpaque(false);
content.add(richTextButton, BorderLayout.CENTER);
content.add(TableLayoutHelper.createTableLayoutPane(new Component[][]{
new Component[]{emptyLabel, richTextButton}},
new double[]{TableLayout.PREFERRED},
new double[]{TableLayout.PREFERRED, TableLayout.FILL}), BorderLayout.CENTER);
return content;
}
@Override
public Object getComboBoxSelected() {
return ActionFactory.createAction(RichTextCellAction.class);
}
@Override
protected void refreshDetails() {
RichTextCellAction subReportCellAction = new RichTextCellAction(tc);
subReportCellAction.setName(Inter.getLocText("FR-Designer_RichTextEditor"));
subReportCellAction.setName(Inter.getLocText("Edit"));
subReportCellAction.setSmallIcon(null);
richTextButton.setAction(subReportCellAction);
}

55
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.Style;
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.quickeditor.CellQuickEditor;
import com.fr.report.ReportHelper;
@ -22,13 +23,11 @@ import java.awt.event.KeyEvent;
*
*/
public class CellStringQuickEditor extends CellQuickEditor {
//文本域
//TODO 9.0 文本域要根据具体文本数量自适应大小,比较难搞,先跳过。
private UITextField stringTextField;
//文本域 直接可以自适应大小
private UITextArea stringTextArea;
//编辑状态
private boolean isEditing = false;
//august:如果是原来编辑的是公式,要保留公式里的这些属性,不然在公式和字符串转化时,就会丢失这些属性设置。
private boolean reserveInResult = false;
private boolean reserveOnWriteOrAnaly = true;
@ -36,17 +35,17 @@ public class CellStringQuickEditor extends CellQuickEditor {
private DocumentListener documentListener = new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim());
changeReportPaneCell(stringTextArea.getText().trim());
}
@Override
public void removeUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim());
changeReportPaneCell(stringTextArea.getText().trim());
}
@Override
public void changedUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim());
changeReportPaneCell(stringTextArea.getText().trim());
}
};
@ -57,22 +56,37 @@ public class CellStringQuickEditor extends CellQuickEditor {
/**
* 详细信息面板
* todo 文本框可自适应大小公式编辑新写一个
*/
@Override
public JComponent createCenterBody() {
JPanel content = new JPanel(new BorderLayout());
content.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
stringTextField = new UITextField();
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
public void keyReleased(KeyEvent e) {
if (tc != null) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
return;
}
tc.getGrid().dispatchEvent(e);
}
}
});
content.add(stringTextField, BorderLayout.CENTER);
content.add(stringTextArea, BorderLayout.CENTER);
return content;
}
@ -104,7 +118,7 @@ public class CellStringQuickEditor extends CellQuickEditor {
}
}
fireTargetModified();
stringTextField.requestFocus();
stringTextArea.requestFocus();
isEditing = false;
}
@ -130,7 +144,7 @@ public class CellStringQuickEditor extends CellQuickEditor {
}
}
showText(str);
stringTextField.setEditable(tc.isSelectedOneCell());
stringTextArea.setEditable(tc.isSelectedOneCell());
}
/**
@ -143,9 +157,14 @@ public class CellStringQuickEditor extends CellQuickEditor {
if (isEditing) {
return;
}
stringTextField.getDocument().removeDocumentListener(documentListener);
stringTextField.setText(str);
stringTextField.getDocument().addDocumentListener(documentListener);
stringTextArea.getDocument().removeDocumentListener(documentListener);
stringTextArea.setText(str);
stringTextArea.getDocument().addDocumentListener(documentListener);
}
@Override
public Object getComboBoxSelected() {
return null;
}
}

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

@ -1,7 +1,10 @@
package com.fr.quickeditor.cellquick;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.insert.cell.SubReportCellAction;
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.quickeditor.CellQuickEditor;
@ -22,22 +25,29 @@ public class CellSubReportEditor extends CellQuickEditor {
super();
}
@SuppressWarnings("Duplicates")
@Override
public JComponent createCenterBody() {
JPanel content = new JPanel(new BorderLayout());
content.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
subReportButton = new UIButton();
subReportButton.setOpaque(false);
content.add(subReportButton, BorderLayout.CENTER);
content.add(TableLayoutHelper.createTableLayoutPane(new Component[][]{
new Component[]{emptyLabel, subReportButton}},
new double[]{TableLayout.PREFERRED},
new double[]{TableLayout.PREFERRED, TableLayout.FILL}), BorderLayout.CENTER);
return content;
}
@Override
protected void refreshDetails() {
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);
}
@Override
public Object getComboBoxSelected() {
return ActionFactory.createAction(SubReportCellAction.class);
}
}

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;
public abstract class TemplateComponentAction<T extends TargetComponent> extends UndoableAction implements TemplateComponentActionInterface<T> {
private T t;
protected TemplateComponentAction(T t) {
this.t = t;
}
protected void setEditingComponent(T t) {
this.t = t;
}
@Override
public T getEditingComponent() {
return t;
}
@Override
public void prepare4Undo() {
this.getEditingComponent().fireTargetModified();
private T t;
protected TemplateComponentAction() {
}
protected TemplateComponentAction(T t) {
this.t = t;
}
protected void setEditingComponent(T t) {
this.t = t;
}
@Override
public T getEditingComponent() {
return t;
}
@Override
public void prepare4Undo() {
this.getEditingComponent().fireTargetModified();
T component = getEditingComponent();
if (component == null) {
return;
}
component.requestFocus();
}
}
/**
* update enable
@ -35,6 +39,6 @@ public abstract class TemplateComponentAction<T extends TargetComponent> extends
*/
@Override
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.file.HistoryTemplateListPane;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.selection.QuickEditor;
import javax.swing.*;
@ -132,6 +133,17 @@ public class ActionFactory {
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.
*
@ -190,7 +202,7 @@ public class ActionFactory {
}
if (jTemplate.acceptToolbarItem(clazz)) {
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));
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
@ -200,6 +212,24 @@ public class ActionFactory {
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;
}
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));
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);

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

@ -1,5 +1,7 @@
package com.fr.design.border;
import com.fr.design.constants.UIConstants;
import java.awt.Color;
import javax.swing.BorderFactory;
@ -19,7 +21,7 @@ public class UITitledBorder extends TitledBorder {
}
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.setTitle(title);

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

@ -88,8 +88,8 @@ public interface UIConstants {
public static final Color AUTHORITY_SHEET_UNSELECTED = new Color(146, 192, 225);
public static final Color ATTRIBUTE_PRESS = new Color(0x419BF9);
public static final Color NORMAL_BLUE = new Color(0x419BF9);
public static final Color ATTRIBUTE_NORMAL = new Color(0xDADADD);
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 TEXT_FILED_BORDER_SELECTED = new Color(0x3384f0);
public static final Color SHEET_NORMAL = new Color(0xc8c8ca);
@ -100,6 +100,8 @@ public interface UIConstants {
public static final Color RULER_SCALE_COLOR = new Color(0x4e504f);
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 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");

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

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

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

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

@ -1,5 +1,6 @@
package com.fr.design.gui.controlpane;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itoolbar.UIToolBarUI;
@ -276,7 +277,10 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
setUndecorated(true);
pane.setBorder(BorderFactory.createEmptyBorder(20, 10, 10, 10));
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);
// pack();
this.setVisible(false);

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

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

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

@ -31,37 +31,38 @@ public class UITableEditorPane<T> extends BasicPane {
private String leftLabelName;
private JPanel buttonPane;
public UITableEditorPane(UITableModelAdapter<T> model) {
this.tableModel = model;
this.initComponent(model.createAction());
}
public UITableEditorPane(UITableModelAdapter<T> model, String s) {
leftLabelName = s;
this.tableModel = model;
this.initComponent(model.createAction());
}
private void initComponent(UITableEditAction[] action) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel pane = new JPanel(new BorderLayout(4, 4));
this.add(pane, BorderLayout.CENTER);
UILabel l = new UILabel(leftLabelName);
editTable = tableModel.createTable();
UIScrollPane scrollPane = new UIScrollPane(editTable);
scrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC));
pane.add(scrollPane, BorderLayout.CENTER);
initbuttonPane(action);
JPanel controlPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
controlPane.add(buttonPane, BorderLayout.EAST);
controlPane.add(l, BorderLayout.WEST);
pane.add(controlPane, BorderLayout.NORTH);
}
public UITableModelAdapter<T> getTableModel() {
public UITableEditorPane(UITableModelAdapter<T> model) {
this.tableModel = model;
this.initComponent(model.createAction());
}
public UITableEditorPane(UITableModelAdapter<T> model, String s) {
leftLabelName = s;
this.tableModel = model;
this.initComponent(model.createAction());
}
private void initComponent(UITableEditAction[] action) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel pane = new JPanel(new BorderLayout(4, 4));
this.add(pane, BorderLayout.CENTER);
UILabel l = new UILabel(leftLabelName);
editTable = tableModel.createTable();
editTable.getTableHeader().setBackground(UIConstants.DEFAULT_BG_RULER);
UIScrollPane scrollPane = new UIScrollPane(editTable);
scrollPane.setBorder(new UIRoundedBorder(UIConstants.TITLED_BORDER_COLOR, 1, UIConstants.ARC));
pane.add(scrollPane, BorderLayout.CENTER);
initbuttonPane(action);
JPanel controlPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
controlPane.add(buttonPane, BorderLayout.EAST);
controlPane.add(l, BorderLayout.WEST);
pane.add(controlPane, BorderLayout.NORTH);
}
public UITableModelAdapter<T> getTableModel(){
return tableModel;
}

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

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

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

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

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

@ -300,7 +300,7 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
private JPanel createLeftPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {f};
double[] columnSize = {p};
double[] rowSize = {p, p, p};
Component[][] components = new Component[][]{
new Component[]{fontSizeStyleComboBox},
@ -325,8 +325,8 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
private JPanel createPane() {
JPanel createPane = new JPanel(new BorderLayout(3, 5));
createPane.add(fontNameComboBox, BorderLayout.NORTH);
createPane.add(createLeftPane(), BorderLayout.CENTER);
createPane.add(createRightPane(), BorderLayout.EAST);
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{createLeftPane(), createRightPane()}}, TableLayoutHelper.FILL_LASTCOLUMN, 5, 7);
createPane.add(jPanel, BorderLayout.CENTER);
return createPane;
}

5
designer_base/src/com/fr/design/javascript/EmailPane.java

@ -2,6 +2,7 @@ package com.fr.design.javascript;
import com.fr.base.ConfigManager;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
@ -83,8 +84,8 @@ public class EmailPane extends FurtherBasicBeanPane<EmailJavaScript> {
tipsPane1.setText(valid ? StringUtils.BLANK : Inter.getLocText("FR-Designer_EmailPane-warnings"));
centerPane.setEnabled(valid);
mainTextEditor.setEnabled(valid);
mainTextEditor.setBackground(valid ? Color.WHITE : new Color(244, 243, 233));
mainTextEditor.setBorder(BorderFactory.createLineBorder(valid ? new Color(128, 152, 186) : new Color(201, 198,184)));
mainTextEditor.setBackground(valid ? Color.WHITE : UIConstants.DEFAULT_BG_RULER);
mainTextEditor.setBorder(BorderFactory.createLineBorder(valid ? new Color(128, 152, 186) : UIConstants.TITLED_BORDER_COLOR));
maitoEditor.setEnabled(valid);
ccEditor.setEnabled(valid);
bccEditor.setEnabled(valid);

5
designer_base/src/com/fr/design/javascript/JavaScriptImplPane.java

@ -73,16 +73,17 @@ public class JavaScriptImplPane extends FurtherBasicBeanPane<JavaScriptImpl> {
};
importedJsPane = new UITableEditorPane<String>(model);
importedJsPane.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(ModLineBorder.TOP), Inter.getLocText("ReportServerP-Import_JavaScript")));
importedJsPane.setPreferredSize(new Dimension(400, 150));
importedJsPane.setPreferredSize(new Dimension(265, 150));
jsPane = new JSContentPane(args);
jsPane.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(ModLineBorder.TOP), Inter.getLocText("FR-Designer_JavaScript")));
parameterPane.setPreferredSize(new Dimension(200, 150));
parameterPane.setPreferredSize(new Dimension(265, 150));
JPanel topPane = GUICoreUtils.createBorderLayoutPane(
importedJsPane, BorderLayout.CENTER,
parameterPane, BorderLayout.EAST
);
topPane.setPreferredSize(new Dimension(300, 150));
topPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 12, 0));
this.setLayout(new BorderLayout());
this.add(topPane,BorderLayout.NORTH) ;

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

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

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

@ -3,9 +3,9 @@
*/
package com.fr.design.mainframe.widget.accessibles;
import java.awt.Dimension;
import java.awt.*;
import javax.swing.SwingUtilities;
import javax.swing.*;
import com.fr.general.Background;
import com.fr.design.mainframe.widget.wrappers.BackgroundWrapper;

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

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

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

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

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

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

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

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

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

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

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

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

2
designer_base/src/com/fr/design/mainframe/widget/editors/DataBindingEditor.java

@ -58,7 +58,7 @@ public class DataBindingEditor extends Editor<DataBinding> {
public DataBindingEditor() {
this.initCompontents();
this.setName(Inter.getLocText("FieldBinding"));
this.setName(Inter.getLocText("FR-Designer_Widget_Field"));
}

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

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

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

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

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

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

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

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

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

9
designer_base/src/com/fr/design/menu/ToolBarDef.java

@ -1,14 +1,13 @@
package com.fr.design.menu;
import com.fr.design.gui.itoolbar.UIToolBarUI;
import com.fr.design.gui.itoolbar.UIToolbar;
import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
import javax.swing.*;
import com.fr.design.gui.itoolbar.UIToolBarUI;
import com.fr.design.gui.itoolbar.UIToolbar;
/**
* Define toolbar..
*/

3
designer_base/src/com/fr/design/scrollruler/ModLineBorder.java

@ -7,6 +7,7 @@ import java.awt.Insets;
import javax.swing.border.AbstractBorder;
import com.fr.design.constants.UIConstants;
import com.fr.design.utils.gui.GUICoreUtils;
/**
@ -31,7 +32,7 @@ public class ModLineBorder extends AbstractBorder {
* @param modifiers modifiers
*/
public ModLineBorder(int modifiers) {
this(modifiers, GUICoreUtils.getTitleLineBorderColor(), 1);
this(modifiers, UIConstants.TITLED_BORDER_COLOR, 1);
}
/**

2
designer_base/src/com/fr/design/utils/gui/GUIPaintUtils.java

@ -19,7 +19,7 @@ public class GUIPaintUtils {
if (BaseUtils.isAuthorityEditing() && isAuthorityEdited) {
g2d.setColor(UIConstants.AUTHORITY_LINE_COLOR);
} else {
g2d.setColor(UIConstants.LINE_COLOR);
g2d.setColor(UIConstants.TITLED_BORDER_COLOR);
}
if (isRound) {
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

6
designer_base/src/com/fr/start/BaseDesigner.java

@ -12,7 +12,6 @@ import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.TemplateTreePane;
import com.fr.design.fun.DesignerStartOpenFileProcessor;
import com.fr.design.fun.GlobalListenerProvider;
import com.fr.design.fun.impl.GlobalListenerProviderManager;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.TemplatePane;
@ -36,7 +35,6 @@ import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.lang.reflect.Method;
import java.util.Set;
/**
* The main class of Report Designer.
@ -84,6 +82,8 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
DesignUtils.initLookAndFeel();
DesignUtils.creatListeningServer(getStartPort(), startFileSuffix());
//初始化插件引擎
PluginManager.init();
// 初始化Log Handler
DesignerEnvManager.loadLogSetting();
DesignerFrame df = createDesignerFrame();
@ -93,7 +93,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
initDefaultFont();
//PluginManager要在环境切换和模块启动之前初始化
PluginManager.init();
PluginManager.registerEnvListener();
// 必须先初始化Env再去startModule, 不然会导致lic读取不到
ModuleContext.startModule(module2Start());

4
designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperRelateFloatLinkPane.java

@ -4,6 +4,7 @@ import com.fr.base.Utils;
import com.fr.chart.web.ChartHyperRelateFloatLink;
import com.fr.design.DesignModelAdapter;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.constants.UIConstants;
import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.design.gui.frpane.ReportletParameterViewPane;
@ -18,6 +19,7 @@ import com.fr.stable.ParameterProvider;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.LineBorder;
import javax.swing.border.TitledBorder;
import java.awt.*;
import java.util.List;
@ -57,7 +59,7 @@ public class ChartHyperRelateFloatLinkPane extends BasicBeanPane<ChartHyperRelat
pane.add(new UILabel(Inter.getLocText("M_Insert-Float") + ":"));
pane.add(floatNameBox);
Border boder = null;
Border boder = new LineBorder(UIConstants.TITLED_BORDER_COLOR);
Font font = null;
TitledBorder border = new TitledBorder(boder, Inter.getLocText(new String[]{"Related", "M_Insert-Float"}), 4, 2, font, new Color(1, 159, 222));
// 圆角不行

12
designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleWLayoutBorderStyleEditor.java

@ -3,9 +3,6 @@
*/
package com.fr.design.mainframe.widget.accessibles;
import java.awt.Dimension;
import javax.swing.SwingUtilities;
import com.fr.design.mainframe.widget.editors.ITextComponent;
import com.fr.design.mainframe.widget.renderer.LayoutBorderStyleRenderer;
@ -15,6 +12,9 @@ import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.xpane.LayoutBorderPane;
import com.fr.form.ui.LayoutBorderStyle;
import javax.swing.*;
import java.awt.*;
public class AccessibleWLayoutBorderStyleEditor extends UneditableAccessibleEditor {
private LayoutBorderPane borderPane;
@ -26,7 +26,11 @@ public class AccessibleWLayoutBorderStyleEditor extends UneditableAccessibleEdit
protected ITextComponent createTextField() {
return new RendererField(new LayoutBorderStyleRenderer());
}
protected void setBorderVisible(){
this.setBorder(BorderFactory.createLineBorder(Color.lightGray));
}
@Override
protected void showEditorPane() {
if (borderPane == null) {

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

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

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

@ -15,6 +15,7 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.accessibles.AccessibleBackgroundEditor;
import com.fr.design.widget.ui.designer.AbstractDataModify;
import com.fr.form.ui.container.WParameterLayout;
import com.fr.general.Background;
import com.fr.general.Inter;
import com.fr.stable.Constants;
@ -59,12 +60,15 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("Form-Desin_Width")), designerWidth},
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
return panel;
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 10);
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
jPanel.add(panel);
return jPanel;
}
public JPanel createAdvancePane() {
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
displayReport = new UICheckBox(Inter.getLocText("FR-Designer_DisplayNothingBeforeQuery"));
background = new AccessibleBackgroundEditor();
Icon[] hAlignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"),
@ -84,9 +88,10 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
new Component[]{displayReport, null},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_WidgetDisplyPosition")), hAlignmentPane}
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
return panel;
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 10);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
jPanel.add(panel);
return jPanel;
}
@Override
@ -108,7 +113,7 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
WParameterLayout wParameterLayout = (WParameterLayout) creator.toData();
wParameterLayout.setDesignWidth((int) designerWidth.getValue());
wParameterLayout.setDelayDisplayContent(displayReport.isSelected());
wParameterLayout.setBackground(wParameterLayout.getBackground());
wParameterLayout.setBackground((Background) background.getValue());
wParameterLayout.setPosition(hAlignmentPane.getSelectedIndex());
return wParameterLayout;
}

2
designer_form/src/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java

@ -7,6 +7,7 @@ import com.fr.design.gui.core.WidgetConstants;
import com.fr.design.parameter.RootDesignDefinePane;
import com.fr.design.widget.ui.designer.*;
import com.fr.design.widget.ui.designer.layout.*;
import com.fr.form.parameter.FormSubmitButton;
import com.fr.form.ui.*;
import com.fr.form.ui.container.*;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
@ -51,6 +52,7 @@ public class FormWidgetDefinePaneFactoryBase {
defineMap.put(NoneWidget.class, new Appearance(NoneWidgetDefinePane.class, WidgetConstants.NONE + ""));
defineMap.put(Button.class, new Appearance(FreeButtonDefinePane.class, WidgetConstants.BUTTON + ""));
defineMap.put(FreeButton.class, new Appearance(FreeButtonDefinePane.class, WidgetConstants.BUTTON + ""));
defineMap.put(FormSubmitButton.class, new Appearance(FreeButtonDefinePane.class, WidgetConstants.BUTTON + ""));
defineMap.put(WFitLayout.class, new Appearance(FRFitLayoutDefinePane.class, Inter.getLocText("FR-Designer-Layout_Adaptive_Layout")));
defineMap.put(WCardMainBorderLayout.class, new Appearance(WCardMainLayoutDefinePane.class, Inter.getLocText("WLayout-Card-ToolTips")));
// if (StableFactory.getMarkedClass(BridgeMark.SUBMIT_BUTTON, Widget.class) != null) {

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

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

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

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

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

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

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

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

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

@ -8,6 +8,7 @@ import com.fr.design.gui.itextfield.UITextField;
import com.fr.form.ui.ComboBox;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
public class ComboBoxDefinePane extends DictEditorDefinePane<ComboBox> {
@ -20,6 +21,7 @@ public class ComboBoxDefinePane extends DictEditorDefinePane<ComboBox> {
public UICheckBox createRepeatCheckBox(){
removeRepeatCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Widget_No_Repeat"));
removeRepeatCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
return removeRepeatCheckBox;
}
@ -30,11 +32,13 @@ public class ComboBoxDefinePane extends DictEditorDefinePane<ComboBox> {
protected void populateSubDictionaryEditorBean(ComboBox ob){
removeRepeatCheckBox.setSelected(ob.isRemoveRepeat());
waterMarkField.setText(ob.getWaterMark());
formWidgetValuePane.populate(ob);
}
protected ComboBox updateSubDictionaryEditorBean(){
ComboBox combo = (ComboBox) creator.toData();
combo.setWaterMark(waterMarkField.getText());
combo.setRemoveRepeat(removeRepeatCheckBox.isSelected());
formWidgetValuePane.update(combo);
return combo;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -36,6 +36,7 @@ public class MultiFileEditorPane extends FieldEditorDefinePane<MultiFileEditor>
protected JPanel setFirstContentPane() {
acceptType = new DictionaryComboBox(DictionaryConstants.acceptTypes, DictionaryConstants.fileTypeDisplays);
singleFileCheckBox = new UICheckBox(Inter.getLocText("SINGLE_FILE_UPLOAD"));
singleFileCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
fileSizeField = new UINumberField();
fontSizeField = new UISpinner(0, 20, 1, 0);
@ -66,9 +67,11 @@ public class MultiFileEditorPane extends FieldEditorDefinePane<MultiFileEditor>
double[] columnSize = {p,f};
int[][] rowCount = {{1, 1},{1, 1},{1, 1},{1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
boundsPane.add(panel);
return panel;
return boundsPane;
}
@Override

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

@ -4,11 +4,13 @@ import com.fr.design.designer.creator.XCreator;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane;
import com.fr.form.ui.NumberEditor;
import com.fr.general.Inter;
import com.fr.third.fr.pdf.layout.border.Border;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
@ -39,105 +41,19 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
private JPanel limitNumberPane;
private WaterMarkDictPane waterMarkDictPane;
private ActionListener actionListener1 = new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (allowDecimalsCheckBox.isSelected()) {
limitNumberPane.setVisible(true);
} else {
limitNumberPane.setVisible(false);
}
}
};
private ActionListener actionListener2 = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (allowNegativeCheckBox.isSelected()) {
minValueModel.setMinimum(-Double.MAX_VALUE);
if (!setMinValueCheckBox.isSelected()) {
maxValueModel.setMinimum(-Double.MAX_VALUE);
}
} else {
minValueModel.setMinimum(0.0);
if (!setMinValueCheckBox.isSelected()) {
maxValueModel.setMinimum(0.0);
}
Double minValue = Double.parseDouble("" + minValueSpinner.getValue());
Double maxValue = Double.parseDouble("" + maxValueSpinner.getValue());
if (minValue < 0.0) {
minValueSpinner.setValue(0.0);
}
if (maxValue < 0.0) {
maxValueSpinner.setValue(0.0);
}
}
}
};
private ActionListener actionListener1;
private ActionListener actionListener3 = new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (setMaxValueCheckBox.isSelected()) {
maxValueSpinner.setEnabled(true);
Double value = new Double(0);
if (setMinValueCheckBox.isSelected()) {
Double minValue = Double.parseDouble("" + minValueSpinner.getValue());
if (minValue > value) {
value = minValue;
}
}
maxValueSpinner.setValue(value);
} else {
maxValueSpinner.setEnabled(false);
minValueModel.setMaximum(Double.MAX_VALUE);
}
}
};
private ActionListener actionListener2;
private ActionListener actionListener4 = new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (setMinValueCheckBox.isSelected()) {
minValueSpinner.setEnabled(true);
Double value = new Double(0);
if (setMaxValueCheckBox.isSelected()) {
Double maxValue = Double.parseDouble("" + maxValueSpinner.getValue());
if (maxValue < value) {
value = maxValue;
}
}
minValueSpinner.setValue(value);
} else {
minValueSpinner.setEnabled(false);
maxValueModel.setMinimum(allowNegativeCheckBox.isSelected() ? (-Double.MAX_VALUE) : new Double(0));
}
}
};
private ActionListener actionListener3;
private ChangeListener changeListener1 = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (setMaxValueCheckBox.isSelected()) {
if (setMinValueCheckBox.isSelected()) {
minValueModel.setMaximum(Double.parseDouble("" + maxValueSpinner.getValue()));
}
}
}
};
private ActionListener actionListener4 ;
private ChangeListener changeListener2 = new ChangeListener() {
private ChangeListener changeListener1;
@Override
public void stateChanged(ChangeEvent e) {
if (setMinValueCheckBox.isSelected()) {
if (setMaxValueCheckBox.isSelected()) {
maxValueModel.setMinimum(Double.parseDouble("" + minValueSpinner.getValue()));
}
}
}
};
private ChangeListener changeListener2 ;
public NumberEditorDefinePane() {
super();
@ -165,28 +81,133 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
double[] columnSize = {p,f};
int[][] rowCount = {{1, 3},{1, 1},{1, 1}};
JPanel advancePane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
advancePane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
return advancePane;
JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
advancePane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
boundsPane.add(advancePane);
return boundsPane;
}
private void initListeners(){
actionListener1 = new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (allowDecimalsCheckBox.isSelected()) {
limitNumberPane.setVisible(true);
} else {
limitNumberPane.setVisible(false);
}
}
};
actionListener2 = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (allowNegativeCheckBox.isSelected()) {
minValueModel.setMinimum(-Double.MAX_VALUE);
if (!setMinValueCheckBox.isSelected()) {
maxValueModel.setMinimum(-Double.MAX_VALUE);
}
} else {
minValueModel.setMinimum(0.0);
if (!setMinValueCheckBox.isSelected()) {
maxValueModel.setMinimum(0.0);
}
Double minValue = Double.parseDouble("" + minValueSpinner.getValue());
Double maxValue = Double.parseDouble("" + maxValueSpinner.getValue());
if (minValue < 0.0) {
minValueSpinner.setValue(0.0);
}
if (maxValue < 0.0) {
maxValueSpinner.setValue(0.0);
}
}
}
};
actionListener3 = new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (setMaxValueCheckBox.isSelected()) {
maxValueSpinner.setEnabled(true);
Double value = new Double(0);
if (setMinValueCheckBox.isSelected()) {
Double minValue = Double.parseDouble("" + minValueSpinner.getValue());
if (minValue > value) {
value = minValue;
}
}
maxValueSpinner.setValue(value);
} else {
maxValueSpinner.setEnabled(false);
minValueModel.setMaximum(Double.MAX_VALUE);
}
}
};
actionListener4 = new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (setMinValueCheckBox.isSelected()) {
minValueSpinner.setEnabled(true);
Double value = new Double(0);
if (setMaxValueCheckBox.isSelected()) {
Double maxValue = Double.parseDouble("" + maxValueSpinner.getValue());
if (maxValue < value) {
value = maxValue;
}
}
minValueSpinner.setValue(value);
} else {
minValueSpinner.setEnabled(false);
maxValueModel.setMinimum(allowNegativeCheckBox.isSelected() ? (-Double.MAX_VALUE) : new Double(0));
}
}
};
changeListener1 = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (setMaxValueCheckBox.isSelected()) {
if (setMinValueCheckBox.isSelected()) {
minValueModel.setMaximum(Double.parseDouble("" + maxValueSpinner.getValue()));
}
}
}
};
changeListener2 = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (setMinValueCheckBox.isSelected()) {
if (setMaxValueCheckBox.isSelected()) {
maxValueModel.setMinimum(Double.parseDouble("" + minValueSpinner.getValue()));
}
}
}
};
}
public JPanel setValidatePane() {
initListeners();
// super.addValidatePane();
this.allowDecimalsCheckBox = new UICheckBox(Inter.getLocText("Allow_Decimals"));
this.decimalLength = new com.fr.design.editor.editor.IntegerEditor();
this.decimalLength.setColumns(4);
allowDecimalsCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
this.allowDecimalsCheckBox.addActionListener(actionListener1);
this.allowNegativeCheckBox = new UICheckBox(Inter.getLocText("Allow_Negative"));
this.allowNegativeCheckBox.addActionListener(actionListener2);
allowNegativeCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
this.setMaxValueCheckBox = new UICheckBox(Inter.getLocText("Need_Max_Value"), false);
setMaxValueCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
this.maxValueSpinner = new UIBasicSpinner(maxValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D));
maxValueSpinner.setPreferredSize(new Dimension(120, 20));
setNotAllowsInvalid(this.maxValueSpinner);
this.setMaxValueCheckBox.addActionListener(actionListener3);
@ -196,9 +217,9 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
this.minValueSpinner = new UIBasicSpinner(minValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D));
minValueSpinner.setPreferredSize(new Dimension(120, 20));
setNotAllowsInvalid(this.minValueSpinner);
minValueSpinner.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
this.setMinValueCheckBox.addActionListener(actionListener4);
this.minValueSpinner.addChangeListener(changeListener2);
setMinValueCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
double f = TableLayout.FILL;
@ -213,7 +234,8 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
double[] rowSize = {p, p, p, p, p};
double[] columnSize = {p,f};
int[][] rowCount = {{1, 1},{1, 1},{1, 1},{1, 1},{1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 3);
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
return panel;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save