Browse Source

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

master
fanglei 7 years ago
parent
commit
65d206d47e
  1. 2
      designer/src/com/fr/design/actions/ButtonGroupAction.java
  2. 1
      designer/src/com/fr/design/actions/cell/CellWidgetAttrAction.java
  3. 1
      designer/src/com/fr/design/actions/cell/ConditionAttributesAction.java
  4. 207
      designer/src/com/fr/design/actions/cell/style/AlignmentAction.java
  5. 140
      designer/src/com/fr/design/actions/cell/style/ReportFontBoldAction.java
  6. 12
      designer/src/com/fr/design/actions/cell/style/ReportFontItalicAction.java
  7. 13
      designer/src/com/fr/design/actions/cell/style/ReportFontUnderlineAction.java
  8. 1
      designer/src/com/fr/design/actions/edit/HyperlinkAction.java
  9. 149
      designer/src/com/fr/design/dscolumn/DSColumnAdvancedPane.java
  10. 48
      designer/src/com/fr/design/dscolumn/ResultSetGroupDockingPane.java
  11. 10
      designer/src/com/fr/design/expand/SortExpandAttrPane.java
  12. 100
      designer/src/com/fr/design/mainframe/ElementCasePane.java
  13. 15
      designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java
  14. 9
      designer/src/com/fr/design/mainframe/JWorkBook.java
  15. 24
      designer/src/com/fr/design/mainframe/ReportFloatPane.java
  16. 4
      designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java
  17. 13
      designer/src/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java
  18. 3
      designer/src/com/fr/design/mainframe/alphafine/cell/model/AlphaCellModel.java
  19. 3
      designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java
  20. 1
      designer/src/com/fr/design/mainframe/alphafine/cell/render/TitleCellRender.java
  21. 76
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  22. 7
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java
  23. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/bigsearch.png
  24. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/bigsearch@2x.png
  25. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/smallsearch.png
  26. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/smallsearch@2x.png
  27. 2
      designer/src/com/fr/design/mainframe/alphafine/preview/FilePreviewPane.java
  28. 2
      designer/src/com/fr/design/mainframe/alphafine/preview/NoResultPane.java
  29. 7
      designer/src/com/fr/design/mainframe/alphafine/search/manager/FileSearchManager.java
  30. 1
      designer/src/com/fr/design/mainframe/alphafine/search/manager/PluginSearchManager.java
  31. 29
      designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java
  32. 8
      designer/src/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java
  33. 12
      designer/src/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java
  34. 36
      designer/src/com/fr/design/mainframe/form/FormElementCasePaneDelegate.java
  35. 2
      designer/src/com/fr/design/report/UnitFieldPane.java
  36. 4
      designer/src/com/fr/design/widget/CellWidgetCardPane.java
  37. 12
      designer/src/com/fr/design/widget/ui/AbstractDataModify.java
  38. 16
      designer/src/com/fr/design/widget/ui/BasicWidgetPropertySettingPane.java
  39. 4
      designer/src/com/fr/design/widget/ui/ButtonGroupDictPane.java
  40. 15
      designer/src/com/fr/design/widget/ui/CheckBoxDefinePane.java
  41. 6
      designer/src/com/fr/design/widget/ui/ComboBoxDefinePane.java
  42. 3
      designer/src/com/fr/design/widget/ui/ComboCheckBoxDefinePane.java
  43. 30
      designer/src/com/fr/design/widget/ui/DateEditorDefinePane.java
  44. 5
      designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java
  45. 6
      designer/src/com/fr/design/widget/ui/IframeEditorDefinePane.java
  46. 10
      designer/src/com/fr/design/widget/ui/ListEditorDefinePane.java
  47. 5
      designer/src/com/fr/design/widget/ui/MultiFileEditorPane.java
  48. 1
      designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java
  49. 2
      designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java
  50. 6
      designer/src/com/fr/design/widget/ui/TreeComboBoxEditorDefinePane.java
  51. 6
      designer/src/com/fr/design/widget/ui/TreeEditorDefinePane.java
  52. 5
      designer/src/com/fr/design/widget/ui/WaterMarkDictPane.java
  53. 4
      designer/src/com/fr/design/widget/ui/WriteUnableRepeatEditorPane.java
  54. 4
      designer/src/com/fr/design/widget/ui/btn/DefineAppendColumnRowPane.java
  55. 3
      designer/src/com/fr/design/widget/ui/btn/DefineDeleteColumnRowPane.java
  56. 307
      designer/src/com/fr/grid/Grid.java
  57. 4
      designer/src/com/fr/grid/GridHeader.java
  58. 3
      designer/src/com/fr/poly/creator/ECBlockEditor.java
  59. 201
      designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java
  60. 171
      designer/src/com/fr/start/Designer.java
  61. 162
      designer_base/src/com/fr/design/DesignerEnvManager.java
  62. 2
      designer_base/src/com/fr/design/actions/TemplateComponentAction.java
  63. 44
      designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java
  64. 2
      designer_base/src/com/fr/design/actions/server/PlatformManagerAction.java
  65. 11
      designer_base/src/com/fr/design/condition/LiteConditionPane.java
  66. 9
      designer_base/src/com/fr/design/constants/UIConstants.java
  67. 55
      designer_base/src/com/fr/design/data/DesignTableDataManager.java
  68. 3
      designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java
  69. 13
      designer_base/src/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java
  70. 5
      designer_base/src/com/fr/design/data/datapane/preview/PreviewTablePane.java
  71. 13
      designer_base/src/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java
  72. 2
      designer_base/src/com/fr/design/data/tabledata/wrapper/AbstractTableDataWrapper.java
  73. 10
      designer_base/src/com/fr/design/designer/IntervalConstants.java
  74. 10
      designer_base/src/com/fr/design/designer/TargetComponent.java
  75. 32
      designer_base/src/com/fr/design/designer/creator/CRPropertyDescriptor.java
  76. 6
      designer_base/src/com/fr/design/editor/DoubleDeckValueEditorPane.java
  77. 24
      designer_base/src/com/fr/design/editor/ValueEditorPane.java
  78. 4
      designer_base/src/com/fr/design/editor/editor/FormulaEditor.java
  79. 2
      designer_base/src/com/fr/design/file/MutilTempalteTabPane.java
  80. 3
      designer_base/src/com/fr/design/file/NewTemplatePane.java
  81. 29
      designer_base/src/com/fr/design/file/TemplateTreePane.java
  82. 2
      designer_base/src/com/fr/design/formula/FormulaPane.java
  83. 59
      designer_base/src/com/fr/design/gui/HyperlinkFilterHelper.java
  84. 23
      designer_base/src/com/fr/design/gui/controlpane/JListControlPane.java
  85. 19
      designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java
  86. 29
      designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java
  87. 17
      designer_base/src/com/fr/design/gui/controlpane/UINameableListCellRenderer.java
  88. 30
      designer_base/src/com/fr/design/gui/core/WidgetOption.java
  89. 29
      designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java
  90. 3
      designer_base/src/com/fr/design/gui/frpane/RegPane.java
  91. 61
      designer_base/src/com/fr/design/gui/frpane/UICorrelationComboBoxPane.java
  92. 2
      designer_base/src/com/fr/design/gui/ibutton/UIButton.java
  93. 61
      designer_base/src/com/fr/design/gui/ibutton/UIButtonGroup.java
  94. 6
      designer_base/src/com/fr/design/gui/ibutton/UIButtonUI.java
  95. 4
      designer_base/src/com/fr/design/gui/ibutton/UIHeadGroup.java
  96. 24
      designer_base/src/com/fr/design/gui/ibutton/UIToggleButton.java
  97. 2
      designer_base/src/com/fr/design/gui/icombobox/LazyComboBox.java
  98. 13
      designer_base/src/com/fr/design/gui/icombobox/UIComboBoxRenderer.java
  99. 42
      designer_base/src/com/fr/design/gui/ispinner/UISpinner.java
  100. 13
      designer_base/src/com/fr/design/gui/itextfield/UITextField.java
  101. Some files were not shown because too many files have changed in this diff Show More

2
designer/src/com/fr/design/actions/ButtonGroupAction.java

@ -36,7 +36,7 @@ public abstract class ButtonGroupAction extends ElementCaseAction{
break;
}
}
if(value == -1 && createToolBarComponent().hasClick()) {
if(createToolBarComponent().hasClick()) {
index = getSelectedIndex();
createToolBarComponent().setClickState(false);
}

1
designer/src/com/fr/design/actions/cell/CellWidgetAttrAction.java

@ -22,5 +22,6 @@ public class CellWidgetAttrAction extends UpdateAction {
@Override
public void actionPerformed(ActionEvent e) {
EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_SETTINGS);
EastRegionContainerPane.getInstance().setWindow2PreferWidth();
}
}

1
designer/src/com/fr/design/actions/cell/ConditionAttributesAction.java

@ -24,5 +24,6 @@ public class ConditionAttributesAction extends UpdateAction {
@Override
public void actionPerformed(ActionEvent e) {
EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_CONDITION_ATTR);
EastRegionContainerPane.getInstance().setWindow2PreferWidth();
}
}

207
designer/src/com/fr/design/actions/cell/style/AlignmentAction.java

@ -1,111 +1,134 @@
package com.fr.design.actions.cell.style;
import javax.swing.Icon;
import com.fr.base.BaseUtils;
import com.fr.base.Style;
import com.fr.base.chart.BaseChartCollection;
import com.fr.design.constants.UIConstants;
import com.fr.design.actions.ButtonGroupAction;
import com.fr.design.actions.utils.ReportActionUtils;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.general.Inter;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.general.Inter;
import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection;
import com.fr.report.cell.FloatElement;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.Constants;
import javax.swing.*;
public class AlignmentAction extends ButtonGroupAction implements StyleActionInterface {
public AlignmentAction(ElementCasePane t, Icon[] iconArray,
Integer[] valueArray) {
super(t, iconArray, valueArray);
}
/**
* executeStyle
*
* @param style
* @param selectedStyle
* @return style
*/
public Style executeStyle(Style style, Style selectedStyle) {
return style.deriveHorizontalAlignment(getSelectedValue());
}
/**
* 更新Style
*
* @param style style
*/
public void updateStyle(Style style) {
setSelectedIndex(BaseUtils.getAlignment4Horizontal(style));
}
/**
* executeActionReturnUndoRecordNeeded
*
* @return
*/
public boolean executeActionReturnUndoRecordNeeded() {
ElementCasePane reportPane = this.getEditingComponent();
if (reportPane == null) {
return false;
}
return ReportActionUtils.executeAction(this, reportPane);
}
/**
* update
*/
public void update() {
super.update();
//peter:如果当前没有ReportFrame,不需要继续.
if (!this.isEnabled()) {
return;
}
//got simple cell element from row and column
ElementCasePane reportPane = this.getEditingComponent();
if (reportPane == null) {
this.setEnabled(false);
return;
}
Selection cs = reportPane.getSelection();
TemplateElementCase tplEC = reportPane.getEditingElementCase();
if (tplEC != null && cs instanceof FloatSelection) {
FloatElement selectedFloat = tplEC.getFloatElement(((FloatSelection) cs).getSelectedFloatName());
Object value = selectedFloat.getValue();
if (value instanceof BaseChartCollection) {
this.setEnabled(false);
return;
}
}
this.updateStyle(ReportActionUtils.getCurrentStyle(reportPane));
}
/**
* 创建工具条且有提示
*
* @return
*/
public UIButtonGroup<Integer> createToolBarComponent() {
UIButtonGroup<Integer> group = super.createToolBarComponent();
if (group != null) {
group.setForToolBarButtonGroup(true);
group.setAllToolTips(new String[]{Inter.getLocText("StyleAlignment-Left"), Inter.getLocText("Center"), Inter.getLocText("StyleAlignment-Right")});
}
for (int i = 0; i < 3; i++) {
group.getButton(i).setRoundBorder(true, UIConstants.ARC);
group.getButton(i).setBorderPainted(true);
}
return group;
}
private static final Icon[] normalBlackIcon = new Icon[]{
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png")};
private static final Icon[] toggleWhiteIcon = new Icon[]{
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal_white.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal_white.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal_white.png")};
private static final Integer[] valueArray = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT};
public AlignmentAction(ElementCasePane t) {
super(t, normalBlackIcon, valueArray);
}
/**
* executeStyle
*
* @param style
* @param selectedStyle
* @return style
*/
public Style executeStyle(Style style, Style selectedStyle) {
return style.deriveHorizontalAlignment(getSelectedValue());
}
/**
* 更新Style
*
* @param style style
*/
public void updateStyle(Style style) {
UIButtonGroup<Integer> buttonGroup = createToolBarComponent();
int selected = BaseUtils.getAlignment4Horizontal(style);
for (int i = 0; i < normalBlackIcon.length; i++) {
UIToggleButton button = buttonGroup.getButton(i);
Icon currentIcon = button.getIcon();
Icon newIcon = selected == valueArray[i] ? toggleWhiteIcon[i] : normalBlackIcon[i];
if (newIcon != currentIcon) {
button.setIcon(newIcon);
}
}
setSelectedIndex(selected);
}
/**
* executeActionReturnUndoRecordNeeded
*
* @return
*/
public boolean executeActionReturnUndoRecordNeeded() {
ElementCasePane reportPane = this.getEditingComponent();
if (reportPane == null) {
return false;
}
return ReportActionUtils.executeAction(this, reportPane);
}
/**
* update
*/
public void update() {
super.update();
//peter:如果当前没有ReportFrame,不需要继续.
if (!this.isEnabled()) {
return;
}
//got simple cell element from row and column
ElementCasePane reportPane = this.getEditingComponent();
if (reportPane == null) {
this.setEnabled(false);
return;
}
Selection cs = reportPane.getSelection();
TemplateElementCase tplEC = reportPane.getEditingElementCase();
if (tplEC != null && cs instanceof FloatSelection) {
FloatElement selectedFloat = tplEC.getFloatElement(((FloatSelection) cs).getSelectedFloatName());
Object value = selectedFloat.getValue();
if (value instanceof BaseChartCollection) {
this.setEnabled(false);
return;
}
}
this.updateStyle(ReportActionUtils.getCurrentStyle(reportPane));
}
/**
* 创建工具条且有提示
*
* @return
*/
public UIButtonGroup<Integer> createToolBarComponent() {
UIButtonGroup<Integer> group = super.createToolBarComponent();
if (group != null) {
group.setForToolBarButtonGroup(true);
group.setAllToolTips(new String[]{Inter.getLocText("StyleAlignment-Left"), Inter.getLocText("Center"), Inter.getLocText("StyleAlignment-Right")});
}
for (int i = 0; i < 3; i++) {
group.getButton(i).setRoundBorder(true, UIConstants.ARC);
group.getButton(i).setBorderPainted(true);
}
return group;
}
}

140
designer/src/com/fr/design/actions/cell/style/ReportFontBoldAction.java

@ -8,84 +8,96 @@ import com.fr.base.Style;
import com.fr.base.core.StyleUtils;
import com.fr.design.actions.ToggleButtonUpdateAction;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.general.FRFont;
import com.fr.general.Inter;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont;
import com.fr.general.Inter;
import javax.swing.*;
/**
* Bold.
*/
public class ReportFontBoldAction extends AbstractStyleAction implements ToggleButtonUpdateAction {
private UIToggleButton button;
protected Style style;
private UIToggleButton button;
protected Style style;
private final static Icon blackIcon = BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png");
private final static Icon whiteIcon = BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold_white.png");
public ReportFontBoldAction(ElementCasePane t) {
super(t);
public ReportFontBoldAction(ElementCasePane t) {
super(t);
this.setName(Inter.getLocText("FRFont-bold"));
this.setSmallIcon(blackIcon);
}
this.setName(Inter.getLocText("FRFont-bold"));
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png"));
}
/**
* 根据按钮状态获取格式
*
* @param style
* @param defStyle
* @return
*/
@Override
public Style executeStyle(Style style, Style defStyle) {
button = createToolBarComponent();
button.setIcon(getToggleButtonIcon(button.isSelected()));
button.setSelected(!button.isSelected());
if (button.isSelected()) {
setSelectedFont(style);
button.setSelected(false);
} else {
setUnselectedFont(style);
button.setSelected(true);
}
/**
* 根据按钮状态获取格式
*
* @param style
* @param defStyle
* @return
*/
@Override
public Style executeStyle(Style style, Style defStyle) {
createToolBarComponent().setSelected(!createToolBarComponent().isSelected());
if (createToolBarComponent().isSelected()) {
setSelectedFont(style);
createToolBarComponent().setSelected(false);
} else {
setUnselectedFont(style);
createToolBarComponent().setSelected(true);
}
return this.style;
}
return this.style;
}
protected Icon getToggleButtonIcon(boolean isSelected) {
return isSelected ? blackIcon : whiteIcon;
}
protected void setSelectedFont(Style style) {
this.style = StyleUtils.boldReportFont(style);
}
protected void setSelectedFont(Style style) {
this.style = StyleUtils.boldReportFont(style);
}
protected void setUnselectedFont(Style style) {
this.style = StyleUtils.unBoldReportFont(style);
}
protected void setUnselectedFont(Style style) {
this.style = StyleUtils.unBoldReportFont(style);
}
/**
* Update Style.
*/
@Override
public void updateStyle(Style style) {
if (style == null) {
return;
}
FRFont frFont = style.getFRFont();
if (frFont == null) {
return;
}
createToolBarComponent().setSelected(isStyle(frFont));
}
/**
* Update Style.
*/
@Override
public void updateStyle(Style style) {
if (style == null) {
return;
}
FRFont frFont = style.getFRFont();
if (frFont == null) {
return;
}
button = createToolBarComponent();
button.setSelected(isStyle(frFont));
button.setIcon(getToggleButtonIcon(!button.isSelected()));
}
protected boolean isStyle(FRFont frFont) {
return frFont.isBold();
}
protected boolean isStyle(FRFont frFont) {
return frFont.isBold();
}
/**
* Gets component on toolbar.
*
* @return the created components on toolbar.
*/
@Override
public UIToggleButton createToolBarComponent() {
if (button == null) {
button = GUICoreUtils.createToolBarComponent(this);
button.setEventBannded(true);
}
return button;
}
/**
* Gets component on toolbar.
*
* @return the created components on toolbar.
*/
@Override
public UIToggleButton createToolBarComponent() {
if (button == null) {
button = GUICoreUtils.createToolBarComponent(this);
button.setEventBannded(true);
}
return button;
}
}

12
designer/src/com/fr/design/actions/cell/style/ReportFontItalicAction.java

@ -10,16 +10,21 @@ import com.fr.general.FRFont;
import com.fr.general.Inter;
import com.fr.design.mainframe.ElementCasePane;
import javax.swing.*;
/**
* Bold.
*/
public class ReportFontItalicAction extends ReportFontBoldAction {
public ReportFontItalicAction(ElementCasePane t) {
private final static Icon blackIcon = BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png");
private final static Icon whiteIcon = BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic_white.png");
public ReportFontItalicAction(ElementCasePane t) {
super(t);
this.setName(Inter.getLocText("FRFont-italic"));
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png"));
this.setSmallIcon(blackIcon);
}
@ -31,6 +36,9 @@ public class ReportFontItalicAction extends ReportFontBoldAction {
this.style = StyleUtils.unItalicReportFont(style);
}
protected Icon getToggleButtonIcon(boolean isSelected) {
return isSelected ? blackIcon : whiteIcon;
}
protected boolean isStyle(FRFont frFont) {
return frFont.isItalic();

13
designer/src/com/fr/design/actions/cell/style/ReportFontUnderlineAction.java

@ -11,15 +11,21 @@ import com.fr.general.Inter;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.stable.Constants;
import javax.swing.*;
/**
* Bold.
*/
public class ReportFontUnderlineAction extends ReportFontBoldAction {
public ReportFontUnderlineAction(ElementCasePane t) {
private final static Icon blackIcon = BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/underline.png");
private final static Icon whiteIcon = BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/underline_white.png");
public ReportFontUnderlineAction(ElementCasePane t) {
super(t);
this.setName(Inter.getLocText("FRFont-Underline"));
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/underline.png"));
this.setSmallIcon(blackIcon);
}
protected void setSelectedFont (Style style) {
@ -30,6 +36,9 @@ public class ReportFontUnderlineAction extends ReportFontBoldAction {
this.style = StyleUtils.setReportFontUnderline(style, false);
}
protected Icon getToggleButtonIcon(boolean isSelected) {
return isSelected ? blackIcon : whiteIcon;
}
protected boolean isStyle(FRFont frFont) {
return frFont.getUnderline() != Constants.LINE_NONE;

1
designer/src/com/fr/design/actions/edit/HyperlinkAction.java

@ -25,5 +25,6 @@ public class HyperlinkAction extends UpdateAction {
@Override
public void actionPerformed(ActionEvent e) {
EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_HYPERLINK);
EastRegionContainerPane.getInstance().setWindow2PreferWidth();
}
}

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

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

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

@ -23,7 +23,7 @@ import java.awt.event.ItemListener;
* 这个pane是选中数据列后在上方QuickRegion处显示的pane
*
* @author zhou, yaoh.wu
* @version 2017年8月2日14点55
* @version 2017年9月26日17点22
* @since 8.0
*/
public class ResultSetGroupDockingPane extends ResultSetGroupPane {
@ -70,7 +70,6 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
cardLayout.show(cardPane, "groupPane");
cardPane.setPreferredSize(new Dimension(158, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 10);
checkButtonEnabled();
} else if (i == BIND_SELECTED) {
cardLayout.show(cardPane, "listPane");
cardPane.setPreferredSize(new Dimension(0, 0));
@ -81,8 +80,8 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 10);
CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr();
cellExpandAttr.setDirection(Constants.NONE);
checkButtonEnabled();
}
checkButtonEnabled();
}
});
@ -116,13 +115,13 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
@Override
public void populate(TemplateCellElement cellElement) {
//更新面板信息时可能会触发绑定在组件上的事件,先移除这些事件
this.removeListener();
this.cellElement = cellElement;
if (isNPE(cellElement)) return;
if (isNPE(cellElement)) {
return;
}
DSColumn dSColumn = (DSColumn) cellElement.getValue();
// populate groupPane
// RecordGrouper
recordGrouper = dSColumn.getGrouper();
if (recordGrouper instanceof FunctionGrouper && !((FunctionGrouper) recordGrouper).isCustom()) {
int mode = recordGrouper.getDivideMode();
@ -154,13 +153,16 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
this.groupComboBox.setSelectedIndex(ADVANCED);
}
checkButtonEnabled();
//加上面板组件的交互事件监听
this.addListener();
}
@Override
public void update() {
if (isNPE(cellElement)) return;
if (isNPE(cellElement)) {
return;
}
DSColumn dSColumn = (DSColumn) cellElement.getValue();
if (this.goBox.getSelectedIndex() == BIND_GROUP) {
recordGrouper = updateGroupCombox();
} else if (this.goBox.getSelectedIndex() == BIND_SELECTED) {
@ -194,17 +196,21 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
cardPane.setPreferredSize(new Dimension(158, 50));
cardPane.revalidate();
cardPane.repaint();
} else {
return;
}
if (groupComboBox.isEnabled() || functionComboBox.isEnabled()) {
cardPane.setPreferredSize(new Dimension(158, 20));
cardPane.revalidate();
cardPane.repaint();
return;
}
cardPane.setPreferredSize(new Dimension(158, 0));
cardPane.revalidate();
cardPane.repaint();
}
public void addListener(ItemListener listener) {
goBox.addItemListener(listener);
groupComboBox.addItemListener(listener);
functionComboBox.addItemListener(listener);
public void setListener(ItemListener listener) {
this.listener = listener;
}
@ -216,4 +222,16 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
public void setRecordGrouper(RecordGrouper recordGrouper) {
this.recordGrouper = recordGrouper;
}
private void addListener() {
goBox.addItemListener(this.listener);
groupComboBox.addItemListener(this.listener);
functionComboBox.addItemListener(this.listener);
}
private void removeListener() {
goBox.removeItemListener(this.listener);
groupComboBox.removeItemListener(this.listener);
functionComboBox.removeItemListener(this.listener);
}
}

10
designer/src/com/fr/design/expand/SortExpandAttrPane.java

@ -24,11 +24,11 @@ public class SortExpandAttrPane extends JPanel {
public SortExpandAttrPane() {
this.setLayout(new BorderLayout(0, 4));
Icon[] iconArray = {
BaseUtils.readIcon("/com/fr/design/images/expand/none16x16.png"),
BaseUtils.readIcon("/com/fr/design/images/expand/asc.png"),
BaseUtils.readIcon("/com/fr/design/images/expand/des.png")
};
Icon[][] iconArray = {
{BaseUtils.readIcon("/com/fr/design/images/expand/none16x16.png"), BaseUtils.readIcon("/com/fr/design/images/expand/none16x16_selected@1x.png")},
{BaseUtils.readIcon("/com/fr/design/images/expand/asc.png"), BaseUtils.readIcon("/com/fr/design/images/expand/asc_selected.png")},
{BaseUtils.readIcon("/com/fr/design/images/expand/des.png"), BaseUtils.readIcon("/com/fr/design/images/expand/des_selected.png")}
};
String[] nameArray = { Inter.getLocText("Sort-Original"), Inter.getLocText("Sort-Ascending"), Inter.getLocText("Sort-Descending") };
sort_type_pane = new UIButtonGroup(iconArray);
sort_type_pane.setAllToolTips(nameArray);

100
designer/src/com/fr/design/mainframe/ElementCasePane.java

@ -3,34 +3,7 @@
*/
package com.fr.design.mainframe;
import java.awt.AWTEvent;
import java.awt.Adjustable;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.event.*;
import java.lang.reflect.Constructor;
import java.util.Set;
import javax.swing.AbstractAction;
import javax.swing.ActionMap;
import javax.swing.Icon;
import javax.swing.InputMap;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollBar;
import javax.swing.KeyStroke;
import com.fr.base.BaseUtils;
import com.fr.base.DynamicUnitList;
import com.fr.base.FRContext;
import com.fr.base.Formula;
import com.fr.base.ScreenResolution;
import com.fr.base.Style;
import com.fr.base.*;
import com.fr.design.DesignState;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
@ -39,30 +12,8 @@ import com.fr.design.actions.ExitAuthorityEditAction;
import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.cell.BorderAction;
import com.fr.design.actions.cell.CleanAuthorityAction;
import com.fr.design.actions.cell.style.AlignmentAction;
import com.fr.design.actions.cell.style.ReportFontBoldAction;
import com.fr.design.actions.cell.style.ReportFontForegroundAction;
import com.fr.design.actions.cell.style.ReportFontItalicAction;
import com.fr.design.actions.cell.style.ReportFontNameAction;
import com.fr.design.actions.cell.style.ReportFontSizeAction;
import com.fr.design.actions.cell.style.ReportFontUnderlineAction;
import com.fr.design.actions.cell.style.StyleBackgroundAction;
import com.fr.design.actions.columnrow.CancelColumnAction;
import com.fr.design.actions.columnrow.CancelRowAction;
import com.fr.design.actions.columnrow.ColumnHideAction;
import com.fr.design.actions.columnrow.ColumnWidthAction;
import com.fr.design.actions.columnrow.DeleteColumnAction;
import com.fr.design.actions.columnrow.DeleteRowAction;
import com.fr.design.actions.columnrow.FootColumnAction;
import com.fr.design.actions.columnrow.FootRowAction;
import com.fr.design.actions.columnrow.HeadColumnAction;
import com.fr.design.actions.columnrow.HeadRowAction;
import com.fr.design.actions.columnrow.InsertColumnAction;
import com.fr.design.actions.columnrow.InsertRowAction;
import com.fr.design.actions.columnrow.ResetColumnHideAction;
import com.fr.design.actions.columnrow.ResetRowHideAction;
import com.fr.design.actions.columnrow.RowHeightAction;
import com.fr.design.actions.columnrow.RowHideAction;
import com.fr.design.actions.cell.style.*;
import com.fr.design.actions.columnrow.*;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.edit.CopyAction;
import com.fr.design.actions.edit.CutAction;
@ -74,6 +25,7 @@ import com.fr.design.cell.clipboard.CellElementsClip;
import com.fr.design.cell.clipboard.ElementsTransferable;
import com.fr.design.cell.clipboard.FloatElementsClip;
import com.fr.design.cell.editor.*;
import com.fr.design.cell.editor.CellEditor;
import com.fr.design.constants.UIConstants;
import com.fr.design.designer.EditingState;
import com.fr.design.designer.TargetComponent;
@ -83,11 +35,7 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.cell.QuickEditorRegion;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.menu.MenuDef;
import com.fr.design.menu.NameSeparator;
import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef;
import com.fr.design.menu.*;
import com.fr.design.selection.QuickEditor;
import com.fr.design.selection.Selectedable;
import com.fr.design.selection.SelectionEvent;
@ -95,11 +43,7 @@ import com.fr.design.selection.SelectionListener;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.grid.Grid;
import com.fr.grid.GridColumn;
import com.fr.grid.GridCorner;
import com.fr.grid.GridRow;
import com.fr.grid.GridUtils;
import com.fr.grid.*;
import com.fr.grid.dnd.ElementCasePaneDropTarget;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.Selection;
@ -119,9 +63,17 @@ import com.fr.report.elementcase.ElementCase;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.ArrayUtils;
import com.fr.stable.ColumnRow;
import com.fr.stable.Constants;
import com.fr.stable.unit.FU;
import javax.swing.*;
import java.awt.*;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.event.*;
import java.lang.reflect.Constructor;
import java.util.Set;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
/**
@ -186,7 +138,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
/**
* Constructor.
*/
public ElementCasePane(T t) {
public ElementCasePane(T t) {
super(t);
// marks:能触发processEvent,不管是否给component增加listener。这里是使在reportPane中的任意位置滑动鼠标轮都能
// 下拉grid。
@ -209,7 +161,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
this.setLayout(new RGridLayout());
//todo 直接修改分辨率
if (this.resolution == 0){
if (this.resolution == 0) {
this.resolution = ScreenResolution.getScreenResolution();
}
@ -243,7 +195,6 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
}
public int getMenuState() {
return DesignState.WORK_SHEET;
}
@ -294,8 +245,8 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
setFormatState(DesignerContext.FORMAT_STATE_NULL);
formatBrush.setSelected(false);
grid.setCursor(UIConstants.CELL_DEFAULT_CURSOR);
if(DesignerContext.getReferencedElementCasePane() == null){
return;
if (DesignerContext.getReferencedElementCasePane() == null) {
return;
}
((ElementCasePane) DesignerContext.getReferencedElementCasePane()).getGrid().setNotShowingTableSelectPane(true);
@ -348,11 +299,11 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
}
public void setResolution(int resolution){
public void setResolution(int resolution) {
this.resolution = resolution;
}
public int getResolution(){
public int getResolution() {
return this.resolution;
}
@ -390,7 +341,6 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
grid.setDefaultFloatEditor(Image.class, new ImageFloatEditor());
DesignerEnvManager designerEnvManager = DesignerEnvManager.getEnvManager();
grid.setGridLineColor(designerEnvManager.getGridLineColor());
grid.setPaginationLineColor(designerEnvManager.getPaginationLineColor());
}
@ -1150,7 +1100,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
HeadColumnAction headcolumnAction = new HeadColumnAction(this);
FootColumnAction footcolumnAction = new FootColumnAction(this);
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(this, evt.getX(), evt.getY(),this.resolution);
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(this, evt.getX(), evt.getY(), this.resolution);
ElementCase elementCase = this.getEditingElementCase();
boolean cancel = false;
ReportPageAttrProvider reportPageAttr = elementCase.getReportPageAttr();
@ -1268,11 +1218,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
protected ToolBarDef createAlignmentToolBar() {
return ShortCut.asToolBarDef(new ShortCut[]{
new AlignmentAction(this, new Icon[]{
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png")},
new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT})}
new AlignmentAction(this)}
);
}

15
designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java

@ -50,18 +50,22 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
if (!isEditable() && !BaseUtils.isAuthorityEditing()) {
return;
}
doOnSelectionChanged(e);
refreshPropertyPanes();
}
});
this.addTargetModifiedListener(new TargetModifiedListener() {
@Override
public void targetModified(TargetModifiedEvent e) {
CellElementPropertyPane.getInstance().populate(ElementCasePaneDelegate.this);
if (DesignerContext.isRefreshOnTargetModifiedEnabled()) {
refreshPropertyPanes();
} else {
CellElementPropertyPane.getInstance().populate(ElementCasePaneDelegate.this);
}
}
});
}
private void doOnSelectionChanged(SelectionEvent e) {
private void refreshPropertyPanes() {
//在编辑权限,所以要更新权限编辑面板
if (BaseUtils.isAuthorityEditing()) {
AuthorityPropertyPane authorityPropertyPane = new AuthorityPropertyPane(ElementCasePaneDelegate.this);
@ -76,7 +80,7 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
QuickEditorRegion.getInstance().populate(getCurrentEditor());
JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (editingTemplate != null && !editingTemplate.isUpMode()) {
Selection editingSelection = ((ElementCasePaneDelegate)e.getSource()).getSelection();
Selection editingSelection = getSelection();
// 模板初始化完成后,才能初始化超级链接面板
HyperlinkGroupPane hyperlinkGroupPane = editingTemplate.getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance());
hyperlinkGroupPane.populate(ElementCasePaneDelegate.this);
@ -172,6 +176,9 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
for (int i = 0; i < actions.length; i++) {
subMenuDef.addShortCut(actions[i]);
}
// 顺便更新右侧属性面板悬浮元素tab中的菜单项
ReportFloatPane.getInstance().refreshInsertFloatMenu(this);
}
// 格式菜单

9
designer/src/com/fr/design/mainframe/JWorkBook.java

@ -114,10 +114,13 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
if (isEditingPolySheet()) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.POLY);
} else {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT);
EastRegionContainerPane.getInstance().replaceCellElementPane(getEastUpPane());
EastRegionContainerPane.getInstance().replaceCellAttrPane(getEastDownPane());
if (isUpMode()) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_PARA);
} else {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT);
}
}
refreshToolArea();
}
private boolean isEditingPolySheet() {

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

@ -23,7 +23,6 @@ import java.awt.*;
public class ReportFloatPane extends JPanel {
private static ReportFloatPane THIS;
private ElementCasePaneDelegate elementCasePaneDelegate;
private MenuDef insertFloatMenu;
private ReportFloatPane() {
@ -37,12 +36,20 @@ public class ReportFloatPane extends JPanel {
return THIS;
}
public void refreshInsertFloatMenu(ElementCasePaneDelegate elementCasePaneDelegate) {
insertFloatMenu.clearShortCuts();
UpdateAction[] actions = ActionFactory.createFloatInsertAction(ElementCasePane.class, elementCasePaneDelegate);
for (int i = 0; i < actions.length; i++) {
insertFloatMenu.addShortCut(actions[i]);
}
}
private void initComponent() {
this.setLayout(new BorderLayout());
UIToolbar topToolBar = new UIToolbar();
topToolBar.setLayout(new BorderLayout());
insertFloatMenu = createInsertToolBar();
initInsertToolBar();
topToolBar.setPreferredSize(new Dimension(155,20));
topToolBar.add(createButtonUI(), BorderLayout.CENTER);
topToolBar.setBorder(BorderFactory.createEmptyBorder(-1, -1, -1, -1));
@ -66,19 +73,14 @@ public class ReportFloatPane extends JPanel {
this.add(leftTopPane, BorderLayout.NORTH);
}
private MenuDef createInsertToolBar() {
MenuDef insertFloatMenu = new MenuDef(true);
private void initInsertToolBar() {
insertFloatMenu = new MenuDef(true);
insertFloatMenu.setName(KeySetUtils.INSERT_FLOAT.getMenuKeySetName());
insertFloatMenu.setTooltip(Inter.getLocText("FR-Designer_T_Insert_Float"));
insertFloatMenu.setIconPath("com/fr/design/images/control/addPopup.png");
JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
elementCasePaneDelegate = (ElementCasePaneDelegate) editingTemplate.getCurrentElementCasePane();
UpdateAction[] actions = ActionFactory.createFloatInsertAction(ElementCasePane.class, elementCasePaneDelegate);
for (int i = 0; i < actions.length; i++) {
insertFloatMenu.addShortCut(actions[i]);
}
return insertFloatMenu;
ElementCasePaneDelegate elementCasePaneDelegate = (ElementCasePaneDelegate) editingTemplate.getCurrentElementCasePane();
refreshInsertFloatMenu(elementCasePaneDelegate);
}
private UIButton createButtonUI() {

4
designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java

@ -19,7 +19,6 @@ import java.util.List;
* Created by XiaXiang on 2017/5/8.
*/
public class AlphaFineHelper {
public static final NoResultModel NO_RESULT_MODEL = new NoResultModel(Inter.getLocText("FR-Designer_AlphaFine_NoResult"));
public static final NoResultModel NO_CONNECTION_MODEL = new NoResultModel(Inter.getLocText("FR-Designer_ConnectionFailed"));
private static AlphaFineDialog alphaFineDialog;
@ -27,6 +26,9 @@ public class AlphaFineHelper {
* 弹出alphafine搜索面板
*/
public static void showAlphaFineDialog(boolean forceOpen) {
if (!AlphaFineConfigManager.isALPHALicAvailable()) {
return;
}
if (alphaFineDialog == null) {
alphaFineDialog = new AlphaFineDialog(DesignerContext.getDesignerFrame(), forceOpen);
alphaFineDialog.setVisible(true);

13
designer/src/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java

@ -1,25 +1,24 @@
package com.fr.design.mainframe.alphafine.cell.model;
import com.fr.design.actions.UpdateAction;
import com.fr.design.mainframe.alphafine.CellType;
import com.fr.general.FRLogger;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import javax.swing.*;
/**
* Created by XiaXiang on 2017/4/20.
*/
public class ActionModel extends AlphaCellModel {
private Action action;
private UpdateAction action;
public ActionModel(String name, String description, Action action, int searchCount) {
public ActionModel(String name, String description, UpdateAction action, int searchCount) {
this(name, description, action);
setSearchCount(searchCount);
}
public ActionModel(String name, String description, Action action) {
public ActionModel(String name, String description, UpdateAction action) {
super(name, null, CellType.ACTION);
this.action = action;
this.setDescription(description);
@ -43,11 +42,11 @@ public class ActionModel extends AlphaCellModel {
return action != null ? action.hashCode() : 0;
}
public Action getAction() {
public UpdateAction getAction() {
return action;
}
public void setAction(Action action) {
public void setAction(UpdateAction action) {
this.action = action;
}

3
designer/src/com/fr/design/mainframe/alphafine/cell/model/AlphaCellModel.java

@ -68,6 +68,7 @@ public abstract class AlphaCellModel implements Comparable {
public boolean isNeedToSendToServer() {
return true;
}
/**
* model转json
*
@ -102,7 +103,7 @@ public abstract class AlphaCellModel implements Comparable {
@Override
public int compareTo(Object o) {
AlphaCellModel cellModel = (AlphaCellModel)o;
AlphaCellModel cellModel = (AlphaCellModel) o;
int difference = cellModel.getSearchCount() - this.getSearchCount();
if (difference != 0) {
return difference;

3
designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java

@ -5,7 +5,6 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.general.IOUtils;
import com.fr.stable.StringUtils;
import javax.swing.*;
@ -55,7 +54,7 @@ public class ContentCellRender implements ListCellRenderer<Object> {
detailLabel.setForeground(AlphaFineConstants.LIGHT_GRAY);
panel.add(detailLabel, BorderLayout.CENTER);
int width = (int) (titleLabel.getPreferredSize().getWidth() + detailLabel.getPreferredSize().getWidth());
if ( width > AlphaFineConstants.LEFT_WIDTH - OFFSET) {
if (width > AlphaFineConstants.LEFT_WIDTH - OFFSET) {
int nameWidth = (int) (AlphaFineConstants.LEFT_WIDTH - detailLabel.getPreferredSize().getWidth() - OFFSET);
titleLabel.setPreferredSize(new Dimension(nameWidth, AlphaFineConstants.CELL_HEIGHT));
}

1
designer/src/com/fr/design/mainframe/alphafine/cell/render/TitleCellRender.java

@ -3,7 +3,6 @@ package com.fr.design.mainframe.alphafine.cell.render;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.general.IOUtils;
import javax.swing.*;
import java.awt.*;

76
designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

@ -367,7 +367,6 @@ public class AlphaFineDialog extends UIDialog {
* 停止加载状态
*/
private void fireStopLoading() {
searchListModel.resetState();
if (searchResultPane != null) {
removeLeftPane();
}
@ -665,25 +664,18 @@ public class AlphaFineDialog extends UIDialog {
searchTextField.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_DOWN) {
searchResultList.requestFocus();
searchResultList.setSelectedIndex(searchResultList.getSelectedIndex() + 1);
}
}
@Override
public void keyReleased(KeyEvent e) {
int keyCode = e.getKeyCode();
if (keyCode == KeyEvent.VK_ESCAPE) {
if (StringUtils.isBlank(searchTextField.getText()) || ComparatorUtils.equals(searchTextField.getText(), searchTextField.getPlaceHolder())) {
AlphaFineDialog.this.setVisible(false);
} else {
searchTextField.setText(null);
removeSearchResult();
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
if (searchResultList.getModel().getSize() > 1) {
dealWithSearchResult(searchResultList.getSelectedValue());
}
} else if (e.getKeyCode() == KeyEvent.VK_ENTER) {
dealWithSearchResult(searchResultList.getSelectedValue());
}
} else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
if (searchResultList.getSelectedIndex() == searchResultList.getModel().getSize() - 1) {
searchResultList.setSelectedIndex(0);
}
searchResultList.setSelectedIndex(searchResultList.getSelectedIndex() + 1);
} else if (e.getKeyCode() == KeyEvent.VK_UP) {
searchResultList.setSelectedIndex(searchResultList.getSelectedIndex() - 1);
} else escAlphaFine(e);
}
});
@ -754,7 +746,9 @@ public class AlphaFineDialog extends UIDialog {
private void doNavigate() {
AlphaFineDialog.this.dispose();
final AlphaCellModel model = searchResultList.getSelectedValue();
model.doAction();
if (model != null) {
model.doAction();
}
}
/**
@ -888,6 +882,21 @@ public class AlphaFineDialog extends UIDialog {
this.splitLabel = splitLabel;
}
/**
* 键盘退出AlphaFine
*
* @param e
*/
private void escAlphaFine(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
if (StringUtils.isBlank(searchTextField.getText()) || ComparatorUtils.equals(searchTextField.getText(), searchTextField.getPlaceHolder())) {
AlphaFineDialog.this.setVisible(false);
} else {
searchTextField.setText(null);
removeSearchResult();
}
}
}
/**
* +-------------------------------------+
@ -907,7 +916,9 @@ public class AlphaFineDialog extends UIDialog {
*/
@Override
public void setSelectedIndex(int index) {
if (index > 0 && checkSelectedIndex(index)) {
if (index == 0 && getModel().getSize() > 1) {
super.setSelectedIndex(1);
} else if (index > 0 && checkSelectedIndex(index)) {
int previousIndex = getSelectedIndex();
super.setSelectedIndex(index);
AlphaCellModel cellModel = getSelectedValue();
@ -930,21 +941,6 @@ public class AlphaFineDialog extends UIDialog {
}
private void initListListener() {
addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
dealWithSearchResult(getSelectedValue());
} else if (e.getKeyCode() == KeyEvent.VK_UP) {
if (getSelectedIndex() == 1) {
searchTextField.requestFocus();
}
} else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
searchTextField.requestFocus();
}
}
});
addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
@ -968,6 +964,14 @@ public class AlphaFineDialog extends UIDialog {
}
}
});
addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
escAlphaFine(e);
}
});
}
}

7
designer/src/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.alphafine.component;
import com.bulenkov.iconloader.IconLoader;
import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.help.alphafine.AlphaFineContext;
import com.fr.design.actions.help.alphafine.AlphaFineListener;
@ -7,10 +8,8 @@ import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.utils.ThemeUtils;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -22,12 +21,12 @@ public class AlphaFinePane extends BasicPane {
private static AlphaFinePane alphaFinePane;
public AlphaFinePane() {
setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 14));
setLayout(new BorderLayout());
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isEnabled()) {
Toolkit.getDefaultToolkit().addAWTEventListener(AlphaFineDialog.listener(), AWTEvent.KEY_EVENT_MASK);
}
UIButton refreshButton = new UIButton();
refreshButton.setIcon(IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/smallsearch.png"));
refreshButton.setIcon(IconLoader.getIcon("/com/fr/design/mainframe/alphafine/images/smallsearch.png"));
refreshButton.setToolTipText(Inter.getLocText("FR-Designer_AlphaFine"));
refreshButton.set4ToolbarButton();
refreshButton.setRolloverEnabled(false);

BIN
designer/src/com/fr/design/mainframe/alphafine/images/bigsearch.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 503 B

After

Width:  |  Height:  |  Size: 461 B

BIN
designer/src/com/fr/design/mainframe/alphafine/images/bigsearch@2x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 871 B

After

Width:  |  Height:  |  Size: 761 B

BIN
designer/src/com/fr/design/mainframe/alphafine/images/smallsearch.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 299 B

BIN
designer/src/com/fr/design/mainframe/alphafine/images/smallsearch@2x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 539 B

2
designer/src/com/fr/design/mainframe/alphafine/preview/FilePreviewPane.java

@ -18,7 +18,7 @@ public class FilePreviewPane extends JPanel {
float widthScale = (AlphaFineConstants.RIGHT_WIDTH) / (float) image.getWidth();
float heightScale = (AlphaFineConstants.CONTENT_HEIGHT) / (float) image.getHeight();
Image showImage;
showImage = widthScale > heightScale? image.getScaledInstance((int) (image.getWidth() * heightScale), AlphaFineConstants.CONTENT_HEIGHT, Image.SCALE_SMOOTH) : image.getScaledInstance(AlphaFineConstants.RIGHT_WIDTH, (int) (image.getWidth() * widthScale), Image.SCALE_SMOOTH);
showImage = widthScale > heightScale ? image.getScaledInstance((int) (image.getWidth() * heightScale), AlphaFineConstants.CONTENT_HEIGHT, Image.SCALE_SMOOTH) : image.getScaledInstance(AlphaFineConstants.RIGHT_WIDTH, (int) (image.getWidth() * widthScale), Image.SCALE_SMOOTH);
label.setIcon(new ImageIcon(showImage));
add(label);
}

2
designer/src/com/fr/design/mainframe/alphafine/preview/NoResultPane.java

@ -20,7 +20,7 @@ public class NoResultPane extends JPanel {
image.setPreferredSize(new Dimension(150, 111));
image.setHorizontalAlignment(SwingConstants.CENTER);
image.setIcon(IconLoader.getIcon(iconUrl));
image.setBorder(BorderFactory.createEmptyBorder(100,0,0,0));
image.setBorder(BorderFactory.createEmptyBorder(100, 0, 0, 0));
UILabel description = new UILabel(title);
description.setForeground(AlphaFineConstants.MEDIUM_GRAY);
description.setFont(FRFont.getInstance("SimSun", Font.PLAIN, 14));

7
designer/src/com/fr/design/mainframe/alphafine/search/manager/FileSearchManager.java

@ -19,7 +19,12 @@ import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import java.io.*;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

1
designer/src/com/fr/design/mainframe/alphafine/search/manager/PluginSearchManager.java

@ -103,6 +103,7 @@ public class PluginSearchManager implements AlphaFineSearchProcessor {
if (jsonArray != null) {
SearchResult searchResult = new SearchResult();
for (int i = 0; i < jsonArray.length(); i++) {
AlphaFineHelper.checkCancel();
PluginModel cellModel = getPluginModel(jsonArray.optJSONObject(i), false);
if (!AlphaFineHelper.getFilterResult().contains(cellModel)) {
searchResult.add(cellModel);

29
designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java

@ -10,6 +10,7 @@ import com.fr.design.mainframe.alphafine.cell.model.ActionModel;
import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.toolbar.UpdateActionManager;
import com.fr.file.XMLFileManager;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
@ -26,8 +27,17 @@ import com.fr.stable.xml.XMLReadable;
import com.fr.stable.xml.XMLTools;
import com.fr.stable.xml.XMLableReader;
import java.io.*;
import java.util.*;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStream;
import java.io.StringReader;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/**
* Created by XiaXiang on 2017/5/15.
@ -220,21 +230,24 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear
recentModelList = recentKVModelMap.get(searchText);
SearchResult resultModelList = recentModelList;
Iterator<AlphaCellModel> modelIterator = resultModelList.iterator();
SearchResult searchResult = new SearchResult();
while (modelIterator.hasNext()) {
AlphaCellModel model = modelIterator.next();
if (model.getType() == CellType.ACTION && !((ActionModel) model).getAction().isEnabled()) {
modelIterator.remove();
if (model.getType() == CellType.ACTION && !UpdateActionManager.getUpdateActionManager().isEnable(((ActionModel) model).getAction())) {
continue;
} else {
searchResult.add(model);
}
}
Collections.sort(resultModelList);
int size = resultModelList.size();
Collections.sort(searchResult);
int size = searchResult.size();
if (size > MAX_SIZE) {
SearchResult result = new SearchResult();
result.addAll(resultModelList.subList(0, MAX_SIZE));
result.addAll(searchResult.subList(0, MAX_SIZE));
return result;
}
return resultModelList;
return searchResult;
}
}
return recentModelList;

8
designer/src/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java

@ -45,10 +45,10 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
*/
public JPanel createContentPane() {
String[] nameArray = {Inter.getLocText("ExpandD-Not_Expand"), Inter.getLocText("Utils-Top_to_Bottom"), Inter.getLocText("Utils-Left_to_Right")};
Icon[] iconArray = {
BaseUtils.readIcon("/com/fr/design/images/expand/none16x16.png"),
BaseUtils.readIcon("/com/fr/design/images/expand/vertical.png"),
BaseUtils.readIcon("/com/fr/design/images/expand/landspace.png")
Icon[][] iconArray = {
{BaseUtils.readIcon("/com/fr/design/images/expand/none16x16.png"), BaseUtils.readIcon("/com/fr/design/images/expand/none16x16_selected@1x.png")},
{BaseUtils.readIcon("/com/fr/design/images/expand/vertical.png"), BaseUtils.readIcon("/com/fr/design/images/expand/vertical_selected@1x.png")},
{BaseUtils.readIcon("/com/fr/design/images/expand/landspace.png"), BaseUtils.readIcon("/com/fr/design/images/expand/landspace_selected@1x.png")}
};
Byte[] valueArray = {Constants.NONE, Constants.TOP_TO_BOTTOM, Constants.LEFT_TO_RIGHT};
expandDirectionButton = new UIButtonGroup<Byte>(iconArray, valueArray);

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

@ -29,6 +29,8 @@ public class ErrorInfoUploader {
private static ErrorInfoUploader collector;
private static boolean licSupport = true;
// 在一台不能上网的电脑里发现了10w个errorinfo...
private static final int MAX_ERROR_SIZE = 2000;
static {
GeneralContext.addEnvChangedListener(new EnvChangedListener() {
@ -123,6 +125,11 @@ public class ErrorInfoUploader {
}
File[] files = folder.listFiles();
if (files.length > MAX_ERROR_SIZE) {
StableUtils.deleteFile(folder);
return;
}
try {
for (File file : files) {
String filePath = file.getPath();
@ -131,6 +138,11 @@ public class ErrorInfoUploader {
if (suffix.endsWith(SUFFIX)) {
Thread.sleep(1000L);
String content = IOUtils.inputStream2String(new FileInputStream(file));
if (content.length() > MAX_ERROR_SIZE) {
file.delete();
continue;
}
String url = SiteCenter.getInstance().acquireUrlByKind("design.error");
if (sendErroInfo(url, content)) {
file.delete();

36
designer/src/com/fr/design/mainframe/form/FormElementCasePaneDelegate.java

@ -36,32 +36,34 @@ public class FormElementCasePaneDelegate extends ElementCasePane<FormElementCase
this.addSelectionChangeListener(new SelectionListener() {
@Override
public void selectionChanged(SelectionEvent e) {
CellElementPropertyPane.getInstance().populate(FormElementCasePaneDelegate.this);
QuickEditorRegion.getInstance().populate(getCurrentEditor());
// 超级链接
HyperlinkGroupPane hyperlinkGroupPane = DesignerContext.getDesignerFrame().getSelectedJTemplate().
getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance());
hyperlinkGroupPane.populate(FormElementCasePaneDelegate.this);
// 条件属性
ConditionAttributesGroupPane conditionAttributesGroupPane = ConditionAttributesGroupPane.getInstance();
conditionAttributesGroupPane.populate(FormElementCasePaneDelegate.this);
EastRegionContainerPane.getInstance().updateCellElementState(isSelectedOneCell());
refreshPropertyPanes();
}
});
this.addTargetModifiedListener(new TargetModifiedListener() {
@Override
public void targetModified(TargetModifiedEvent e) {
CellElementPropertyPane.getInstance().populate(FormElementCasePaneDelegate.this);
if (DesignerContext.isRefreshOnTargetModifiedEnabled()) {
refreshPropertyPanes();
} else {
CellElementPropertyPane.getInstance().populate(FormElementCasePaneDelegate.this);
}
}
});
}
// private void populateHyperLinkGroupPane() {
// final TemplateElementCase report = this.getEditingElementCase();
// NameJavaScriptGroup nameHyperlinks = ReportHyperlinkGroupPane.getNameJSGroup(this, report);
// HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getHyperLinkPane().populate(nameHyperlinks);
// }
private void refreshPropertyPanes() {
CellElementPropertyPane.getInstance().populate(FormElementCasePaneDelegate.this);
QuickEditorRegion.getInstance().populate(getCurrentEditor());
// 超级链接
HyperlinkGroupPane hyperlinkGroupPane = DesignerContext.getDesignerFrame().getSelectedJTemplate().
getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance());
hyperlinkGroupPane.populate(FormElementCasePaneDelegate.this);
// 条件属性
ConditionAttributesGroupPane conditionAttributesGroupPane = ConditionAttributesGroupPane.getInstance();
conditionAttributesGroupPane.populate(FormElementCasePaneDelegate.this);
EastRegionContainerPane.getInstance().updateCellElementState(isSelectedOneCell());
}
@Override
protected boolean supportRepeatedHeaderFooter() {

2
designer/src/com/fr/design/report/UnitFieldPane.java

@ -48,7 +48,7 @@ public class UnitFieldPane extends JPanel {
} else if (unitType == Constants.UNIT_INCH) {
this.setText(Inter.getLocText("FR-Designer_Unit_INCH"));
} else {
this.setText(Inter.getLocText("FR-Designer_Unit_MM-mm"));
this.setText(Inter.getLocText("FR-Designer_Unit_MM"));
}
//ajust the heigt of unitLabel.

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

@ -1,5 +1,6 @@
package com.fr.design.widget;
import com.fr.design.constants.UIConstants;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.BasicPane;
@ -91,7 +92,8 @@ public class CellWidgetCardPane extends BasicPane {
tabbedPane.show(center, tabTitles[index]);
}
};
tabsHeaderIconPane.setNeedLeftRightOutLine(false);
tabsHeaderIconPane.setNeedLeftRightOutLine(true);
tabsHeaderIconPane.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, UIConstants.SHADOW_GREY));
this.add(tabsHeaderIconPane, BorderLayout.NORTH);
widgetPropertyPane = new BasicWidgetPropertySettingPane();

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

@ -4,12 +4,14 @@ import com.fr.design.beans.BasicBeanPane;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.widget.DataModify;
import javax.swing.*;
import javax.swing.JComponent;
/**
* Created by richie on 15/11/16.
*/
public abstract class AbstractDataModify<T> extends BasicBeanPane<T> implements DataModify<T> {
protected String globalName;
@Override
public DataCreatorUI dataUI() {
@ -20,4 +22,12 @@ public abstract class AbstractDataModify<T> extends BasicBeanPane<T> implements
public JComponent toSwingComponent() {
return this;
}
public void setGlobalName(String globalName){
this.globalName = globalName;
}
public String getGlobalName(){
return globalName;
}
}

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

@ -1,6 +1,6 @@
package com.fr.design.widget.ui;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.dialog.BasicPane;
@ -11,8 +11,11 @@ import com.fr.form.ui.Widget;
import com.fr.general.Inter;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
public class BasicWidgetPropertySettingPane extends BasicPane {
private ParameterTreeComboBox widgetNameComboBox;
@ -28,20 +31,17 @@ public class BasicWidgetPropertySettingPane extends BasicPane {
visibleCheckBox.setBorder(BorderFactory.createEmptyBorder(0,0,0,0));
widgetNameComboBox = new ParameterTreeComboBox();
widgetNameComboBox.refreshTree();
JPanel widgetNamePane = new JPanel(new BorderLayout());
widgetNamePane.add(widgetNameComboBox, BorderLayout.CENTER);
widgetNamePane.setBorder(BorderFactory.createEmptyBorder(0,20,0,0));
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Form-Widget_Name")), widgetNamePane},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Form-Widget_Name")), widgetNameComboBox},
new Component[]{enableCheckBox, null},
new Component[]{visibleCheckBox, null},
};
double[] rowSize = {p, p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1},{1, 1},{1, 1},{1, 1}};
JPanel pane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_LARGE);
JPanel pane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W2, IntervalConstants.INTERVAL_L1);
pane.setBorder(BorderFactory.createEmptyBorder(10,0,10,0));
this.add(pane, BorderLayout.CENTER);

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

@ -5,6 +5,7 @@ import java.awt.*;
import java.awt.event.ActionEvent;
import com.fr.data.Dictionary;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.ispinner.UIBasicSpinner;
import java.awt.event.ActionListener;
@ -57,8 +58,7 @@ public class ButtonGroupDictPane extends JPanel {
{new UILabel(Inter.getLocText("FR-Designer_DS-Dictionary")), dictPane, null},
{adaptiveCheckbox, columnLabel, columnSpinner}
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, 16, 8);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
this.add(panel);

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

@ -1,6 +1,7 @@
package com.fr.design.widget.ui;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
@ -17,28 +18,24 @@ public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> {
private UITextField text;
public CheckBoxDefinePane() {
this.iniComoponents();
this.iniComponents();
}
private void iniComoponents() {
private void iniComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
text = new UITextField();
JPanel panel = new JPanel(new BorderLayout());
panel.add(text, BorderLayout.CENTER);
panel.setBorder(BorderFactory.createEmptyBorder(0, 35, 0, 0));
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Text")), panel},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Text")), text},
};
double[] rowSize = {p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}};
JPanel pane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_LARGE);
JPanel pane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W3, IntervalConstants.INTERVAL_L1);
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 24, pane);
pane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 15));
pane.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 0));
this.add(uiExpandablePane);
}

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

@ -4,6 +4,7 @@ import javax.swing.*;
import com.fr.data.Dictionary;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.accessibles.AccessibleDictionaryEditor;
@ -26,8 +27,9 @@ public class ComboBoxDefinePane extends CustomWritableRepeatEditorPane<ComboBox>
protected JPanel setForthContentPane () {
dictPane = new AccessibleDictionaryEditor();
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_DS-Dictionary")), dictPane}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
jPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(
new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_DS-Dictionary")), dictPane}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
jPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
return jPanel;
}

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

@ -2,6 +2,7 @@ package com.fr.design.widget.ui;
import com.fr.data.Dictionary;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
@ -42,7 +43,7 @@ public class ComboCheckBoxDefinePane extends CustomWritableRepeatEditorPane<Comb
double[] rowSize = {p, p, p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1},{1, 1},{1,1},{1,1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
advancePane.add(panel);
return advancePane;

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

@ -3,6 +3,7 @@ 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.designer.IntervalConstants;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
@ -36,7 +37,7 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
private UIComboBox currentFormatComboBox;
private UILabel currentSamplelabel;
private UIButtonGroup fomatHeadGroup;
private static final int SAMPLE_LABEL_PADDING = 4;
public DateEditorDefinePane() {
@ -58,17 +59,16 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
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-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 }
new Component[]{new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type")), returnTypeComboBox }
};
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));
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1);
return panel;
@ -76,7 +76,13 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
private JPanel createFormatPane(UIComboBox formatComboBox, UILabel sampleLabel){
JPanel previewPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Base_StyleFormat_Sample"));
previewPane.add(sampleLabel);
previewPane.setLayout(new BorderLayout());
JPanel sampleLabelWrapper = new JPanel(new BorderLayout());
sampleLabelWrapper.setBorder(BorderFactory.createEmptyBorder(0, SAMPLE_LABEL_PADDING, SAMPLE_LABEL_PADDING, SAMPLE_LABEL_PADDING));
sampleLabelWrapper.add(sampleLabel, BorderLayout.CENTER);
previewPane.add(sampleLabelWrapper, BorderLayout.CENTER);
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
jPanel.add(previewPane, BorderLayout.NORTH);
jPanel.add(formatComboBox, BorderLayout.CENTER);
@ -84,7 +90,13 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
}
private UILabel createSamplePane(){
UILabel sampleLabel = new UILabel("");
UILabel sampleLabel = new UILabel("") {
@Override
public void setText(String text) {
// 加上<html>可以自动换行
super.setText("<html>" + text + "</html>");
}
};
sampleLabel.setHorizontalAlignment(SwingConstants.CENTER);
sampleLabel.setFont(FRContext.getDefaultValues().getFRFont());
return sampleLabel;

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

@ -32,8 +32,11 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
protected void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel contentPane = this.setFirstContentPane();
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
jPanel.add(contentPane, BorderLayout.CENTER);
contentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
if (contentPane != null) {
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 24, contentPane);
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 24, jPanel);
this.add(uiExpandablePane, BorderLayout.NORTH);
}
this.addValidatePane();

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

@ -2,6 +2,7 @@ package com.fr.design.widget.ui;
import com.fr.base.FRContext;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.DialogActionListener;
import com.fr.design.dialog.UIDialog;
import com.fr.design.foldablepane.UIExpandablePane;
@ -57,14 +58,15 @@ public class IframeEditorDefinePane extends AbstractDataModify<IframeEditor> {
parameterViewPaneButton = new UIButton(Inter.getLocText("FR-Designer_Edit"));
parameterViewPaneButton.addActionListener(parameterListener);
parameterViewPane = new ReportletParameterViewPane();
horizontalCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
verticalCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
java.awt.Component[][] coms = {
{horizontalCheck, null},
{verticalCheck, null},
{new UILabel(Inter.getLocText("Form-Url")), srcTextField = new UITextField()},
{new UILabel(Inter.getLocText("FR-Designer_Parameters")), parameterViewPaneButton}};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(coms, rowSize, columnSize, rowCount, 45, LayoutConstants.VGAP_LARGE);
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(coms, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W3, IntervalConstants.INTERVAL_L1);
contentPane.add(panel);

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

@ -34,12 +34,12 @@ public class ListEditorDefinePane extends WriteUnableRepeatEditorPane<ListEditor
@Override
protected JPanel setThirdContentPane() {
JPanel contenter = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane_First0();
JPanel centerPane = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane_First0();
centerPane.add(needHeadCheckBox = new UICheckBox(Inter.getLocText("List-Need_Head")));
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
needHeadCheckBox = new UICheckBox(Inter.getLocText("List-Need_Head"));
needHeadCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
contenter.add(centerPane);
return contenter;
jPanel.add(needHeadCheckBox, BorderLayout.CENTER);
jPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
return jPanel;
}
@Override

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

@ -1,5 +1,6 @@
package com.fr.design.widget.ui;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.DictionaryComboBox;
import com.fr.design.gui.icombobox.DictionaryConstants;
@ -55,9 +56,7 @@ public class MultiFileEditorPane extends FieldEditorDefinePane<MultiFileEditor>
double[] rowSize = {p, p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 22, 10);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 00));
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
contenter.add(panel, BorderLayout.CENTER);
return contenter;

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

@ -29,7 +29,6 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
protected JPanel setFirstContentPane() {
JPanel content = FRGUIPaneFactory.createBorderLayout_S_Pane();
waterMarkDictPane = new WaterMarkDictPane();
waterMarkDictPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
content.add(waterMarkDictPane, BorderLayout.CENTER);
return content;
}

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

@ -51,9 +51,7 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane<TextEditor>
}
});
JPanel content = FRGUIPaneFactory.createBorderLayout_S_Pane();
waterMarkDictPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
content.add(waterMarkDictPane, BorderLayout.CENTER);
return content;
}

6
designer/src/com/fr/design/widget/ui/TreeComboBoxEditorDefinePane.java

@ -7,6 +7,7 @@ import javax.swing.JPanel;
import com.fr.data.Dictionary;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itree.refreshabletree.TreeRootPane;
import com.fr.design.layout.FRGUIPaneFactory;
@ -38,8 +39,9 @@ public class TreeComboBoxEditorDefinePane extends CustomWritableRepeatEditorPane
protected JPanel setFirstContentPane() {
treeSettingPane = new AccessibleTreeModelEditor();
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel north = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Create_Tree")), treeSettingPane}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
north.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
JPanel north = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Create_Tree")), treeSettingPane}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W2, IntervalConstants.INTERVAL_L1);
north.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
JPanel center = super.setFirstContentPane();
jPanel.add(north, BorderLayout.NORTH);
jPanel.add(center, BorderLayout.CENTER);

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

@ -2,6 +2,7 @@ package com.fr.design.widget.ui;
import com.fr.data.Dictionary;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itree.refreshabletree.TreeRootPane;
@ -55,8 +56,9 @@ public class TreeEditorDefinePane extends FieldEditorDefinePane<TreeEditor> {
protected JPanel setSecondContentPane() {
accessibleTreeModelEditor = new AccessibleTreeModelEditor();
JPanel createTree = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Create_Tree")), accessibleTreeModelEditor}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
createTree.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
JPanel createTree = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Create_Tree")), accessibleTreeModelEditor}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W2, IntervalConstants.INTERVAL_L1);
createTree.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
JPanel contentPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
JPanel contenter = FRGUIPaneFactory.createBorderLayout_S_Pane();

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

@ -1,5 +1,6 @@
package com.fr.design.widget.ui;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.TableLayout;
@ -28,8 +29,8 @@ public class WaterMarkDictPane extends JPanel {
double[] rowSize = {p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 18, 7);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W3, IntervalConstants.INTERVAL_L1);
// panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
this.add(panel, BorderLayout.CENTER);
}

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

@ -5,6 +5,7 @@ import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
@ -36,8 +37,7 @@ public abstract class WriteUnableRepeatEditorPane<E extends WriteUnableRepeatEdi
double[] rowSize = {p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1,1},{1,1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
contentPane.add(panel);
JPanel otherContentPane = this.setThirdContentPane();
if (otherContentPane != null)

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

@ -3,6 +3,8 @@ package com.fr.design.widget.ui.btn;
import java.awt.Component;
import javax.swing.BorderFactory;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
@ -43,7 +45,7 @@ public class DefineAppendColumnRowPane extends BasicPane {
lpane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
lpane.add(new UILabel(Inter.getLocText("Append_Delete_Row_Message")));
Component[][] components = { { new UILabel(Inter.getLocText(new String[]{"Specify", "Cell"})), crEditor }, { rowCountLable, jNumberEditor } ,{lpane,null}};
JPanel contentPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1);
contentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
this.setLayout(FRGUIPaneFactory.createBorderLayout());

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

@ -2,6 +2,7 @@ package com.fr.design.widget.ui.btn;
import javax.swing.*;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
@ -38,7 +39,7 @@ public class DefineDeleteColumnRowPane extends BasicPane {
Component[][] components = {
{ new UILabel(Inter.getLocText(new String[]{"Specify", "Cell"})), crEditor },
{ messageLabel, null}};
JPanel contentPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1);
contentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
setLayout(FRGUIPaneFactory.createBorderLayout());

307
designer/src/com/fr/grid/Grid.java

@ -10,7 +10,6 @@ import com.fr.design.constants.UIConstants;
import com.fr.design.fun.GridUIProcessor;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.templateinfo.TemplateInfoCollector;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.grid.event.CellEditorEvent;
@ -36,7 +35,6 @@ import javax.swing.plaf.ComponentUI;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.geom.Point2D;
import java.util.Date;
import java.util.Hashtable;
import java.util.Iterator;
@ -57,7 +55,7 @@ public class Grid extends BaseGridComponent {
transient private TemplateCellElement editingCellElement;
private boolean showGridLine = true;
private Color gridLineColor = new Color(0xf0f0f3); // line color.
private Color gridLineColor = UIConstants.RULER_LINE_COLOR; // line color.
private boolean isShowPaginateLine = true;
private Color paginationLineColor = Color.RED; // line color of paper
@ -146,12 +144,10 @@ public class Grid extends BaseGridComponent {
}
/**
* 应用界面设置
*
*
* @date 2014-12-21-下午6:32:43
*
*/
* 应用界面设置
*
* @date 2014-12-21-下午6:32:43
*/
public void updateUI() {
GridUIProcessor localGridUIProcessor = ExtraDesignClassManager.getInstance().getSingle(GridUIProcessor.MARK_STRING, new DefaultGridUIProcessor());
ComponentUI localComponentUI = localGridUIProcessor.appearanceForGrid(this.resolution);
@ -160,14 +156,11 @@ public class Grid extends BaseGridComponent {
/**
* 是否显示格子线
*
* @return 是否显示格子线
*
*
* @date 2014-12-21-下午6:32:13
*
*/
* 是否显示格子线
*
* @return 是否显示格子线
* @date 2014-12-21-下午6:32:13
*/
public boolean isShowGridLine() {
return showGridLine;
}
@ -183,7 +176,7 @@ public class Grid extends BaseGridComponent {
this.getElementCasePane().repaint();
}
public GridMouseAdapter getGridMouseAdapter(){
public GridMouseAdapter getGridMouseAdapter() {
return this.gridMouseAdapter;
}
@ -210,14 +203,11 @@ public class Grid extends BaseGridComponent {
}
/**
* 是否显示分页线
*
* @return 是否显示分页线
*
*
* @date 2014-12-21-下午6:31:45
*
*/
* 是否显示分页线
*
* @return 是否显示分页线
* @date 2014-12-21-下午6:31:45
*/
public boolean isShowPaginateLine() {
return isShowPaginateLine;
}
@ -253,14 +243,11 @@ public class Grid extends BaseGridComponent {
/**
* 是否显示垂直冻结线
*
* @return 是否显示垂直冻结线
*
*
* @date 2014-12-21-下午6:29:35
*
*/
* 是否显示垂直冻结线
*
* @return 是否显示垂直冻结线
* @date 2014-12-21-下午6:29:35
*/
public boolean isShowVerticalFrozenLine() {
return isShowVerticalFrozenLine;
}
@ -295,14 +282,11 @@ public class Grid extends BaseGridComponent {
}
/**
* 是否显示水平冻结线
*
* @return 是否显示水平冻结线
*
*
* @date 2014-12-21-下午6:29:35
*
*/
* 是否显示水平冻结线
*
* @return 是否显示水平冻结线
* @date 2014-12-21-下午6:29:35
*/
public boolean isShowHorizontalFrozenLine() {
return isShowHorizontalFrozenLine;
}
@ -377,14 +361,11 @@ public class Grid extends BaseGridComponent {
}
/**
* 组件是否可以被编辑
*
* @return 组件是否可以被编辑
*
*
* @date 2014-12-21-下午6:29:09
*
*/
* 组件是否可以被编辑
*
* @return 组件是否可以被编辑
* @date 2014-12-21-下午6:29:09
*/
public boolean isEditable() {
return editable;
}
@ -501,27 +482,21 @@ public class Grid extends BaseGridComponent {
// /////////////editor begin
/**
* 是否处于编辑状态
*
* @return 是否处于编辑状态
*
*
* @date 2014-12-21-下午6:28:45
*
*/
* 是否处于编辑状态
*
* @return 是否处于编辑状态
* @date 2014-12-21-下午6:28:45
*/
public boolean isEditing() {
return this.editorComponent != null;
}
/**
* 当前编辑对象是否为单元格
*
* @return 当前编辑对象是否为单元格
*
*
* @date 2014-12-21-下午6:28:18
*
*/
* 当前编辑对象是否为单元格
*
* @return 当前编辑对象是否为单元格
* @date 2014-12-21-下午6:28:18
*/
public boolean isCellEditing() {
return this.isEditing() && cellEditor != null && notShowingTableSelectPane;
}
@ -534,27 +509,21 @@ public class Grid extends BaseGridComponent {
}
/**
* 是否处于智能选择单元格阶段
*
* @return 是否处于智能选择单元格阶段
*
*
* @date 2014-12-21-下午6:27:36
*
*/
* 是否处于智能选择单元格阶段
*
* @return 是否处于智能选择单元格阶段
* @date 2014-12-21-下午6:27:36
*/
public boolean IsNotShowingTableSelectPane() {
return this.notShowingTableSelectPane;
}
/**
* 当前是否在编辑悬浮元素
*
* @return 是否在编辑悬浮元素
*
*
* @date 2014-12-21-下午6:26:46
*
*/
* 当前是否在编辑悬浮元素
*
* @return 是否在编辑悬浮元素
* @date 2014-12-21-下午6:26:46
*/
public boolean isFloatEditing() {
return this.isEditing() && floatEditor != null;
}
@ -566,7 +535,7 @@ public class Grid extends BaseGridComponent {
* @param column the column of the cell to edit, where 0 is the first column;
* @param row the row of the cell to edit, where 0 is the first row
* @return the editor for this cell; if <code>null</code> return the default
* editor for this type of cell
* editor for this type of cell
* @see com.fr.design.cell.editor.CellEditor
*/
public CellEditor getCellEditor(int column, int row) {
@ -598,7 +567,7 @@ public class Grid extends BaseGridComponent {
* edited. If nothing is being edited, returns -1.
*
* @return the index of the column that contains the cell currently being
* edited; returns -1 if nothing being edited
* edited; returns -1 if nothing being edited
*/
public int getEditingColumn() {
return editingColumn;
@ -618,7 +587,7 @@ public class Grid extends BaseGridComponent {
* If nothing is being edited, returns -1.
*
* @return the index of the row that contains the cell currently being
* edited; returns -1 if nothing being edited
* edited; returns -1 if nothing being edited
*/
public int getEditingRow() {
return editingRow;
@ -800,25 +769,20 @@ public class Grid extends BaseGridComponent {
}
/**
* 开始单元格编辑
*
*
* @date 2014-12-21-下午6:25:17
*
*/
* 开始单元格编辑
*
* @date 2014-12-21-下午6:25:17
*/
public void startEditing() {
this.startEditing(false);
}
/**
* 开始单元格编辑
*
* @param byKeyEvent 是否为键盘触发
*
*
* @date 2014-12-21-下午6:25:17
*
*/
* 开始单元格编辑
*
* @param byKeyEvent 是否为键盘触发
* @date 2014-12-21-下午6:25:17
*/
protected void startEditing(boolean byKeyEvent) {
ElementCasePane reportPane = this.getElementCasePane();
ElementCase report = reportPane.getEditingElementCase();
@ -867,19 +831,15 @@ public class Grid extends BaseGridComponent {
}
/**
* 开始单元格编辑
*
* @param column
* @param row
* @param cellTypeClass 单元格类型
* @param byKeyEvent 是否为键盘触发
*
* @return 编辑是否成功
*
*
* @date 2014-12-21-下午6:25:17
*
*/
* 开始单元格编辑
*
* @param column
* @param row
* @param cellTypeClass 单元格类型
* @param byKeyEvent 是否为键盘触发
* @return 编辑是否成功
* @date 2014-12-21-下午6:25:17
*/
public boolean startCellEditingAt_DEC(int column, int row, Class cellTypeClass, boolean byKeyEvent) {
if (this.isEditing()) {
this.stopEditing();// 需要先停止正在进行的编辑.
@ -954,12 +914,10 @@ public class Grid extends BaseGridComponent {
}
/**
* 停止编辑状态
*
*
* @date 2014-12-21-下午6:24:54
*
*/
* 停止编辑状态
*
* @date 2014-12-21-下午6:24:54
*/
public void stopEditing() {
// 首先判断是哪种类型的编辑.
if (this.isCellEditing()) {
@ -1117,10 +1075,10 @@ public class Grid extends BaseGridComponent {
if (styleChange || imageChange) {
return true;
}
} else {
if(newValue instanceof RichText){
setShowAsHtml(this.editingCellElement);
}
} else {
if (newValue instanceof RichText) {
setShowAsHtml(this.editingCellElement);
}
Object oldValue = this.editingCellElement.getValue();
if (!ComparatorUtils.equals_exactly(oldValue, newValue)) {
@ -1131,15 +1089,15 @@ public class Grid extends BaseGridComponent {
return false;
}
private void setShowAsHtml(CellElement cellElement){
CellGUIAttr guiAttr = cellElement.getCellGUIAttr();
if(guiAttr == null){
guiAttr = new CellGUIAttr();
cellElement.setCellGUIAttr(guiAttr);
}
private void setShowAsHtml(CellElement cellElement) {
CellGUIAttr guiAttr = cellElement.getCellGUIAttr();
if (guiAttr == null) {
guiAttr = new CellGUIAttr();
cellElement.setCellGUIAttr(guiAttr);
}
guiAttr.setShowAsHTML(true);
}
guiAttr.setShowAsHTML(true);
}
/**
* 当单元格里的内容过长时自动调整单元格
@ -1148,34 +1106,32 @@ public class Grid extends BaseGridComponent {
*/
private void shrinkToFit(TemplateElementCase tplEC) {
if (editingCellElement == null) {
return;
return;
}
Object editElementValue = editingCellElement.getValue();
if (valueNeedFit(editElementValue)) {
int mode = this.getElementCasePane().getReportSettings().getShrinkToFitMode();
int mode = this.getElementCasePane().getReportSettings().getShrinkToFitMode();
GridUtils.shrinkToFit(mode, tplEC, editingCellElement);
}
}
//是否需要根据内容自动调整, 目前只有字符串, 数字, 富文本需要
private boolean valueNeedFit(Object value){
if(value == null){
return false;
}
private boolean valueNeedFit(Object value) {
if (value == null) {
return false;
}
return value instanceof String ||
value instanceof Number ||
value instanceof RichText;
return value instanceof String ||
value instanceof Number ||
value instanceof RichText;
}
/**
* 取消编辑状态
*
*
* @date 2014-12-21-下午6:24:34
*
*/
* 取消编辑状态
*
* @date 2014-12-21-下午6:24:34
*/
public void cancelEditing() {
if (this.isEditing()) {
removeEditor();
@ -1184,12 +1140,10 @@ public class Grid extends BaseGridComponent {
}
/**
* 移除选中组件
*
*
* @date 2014-12-21-下午6:24:16
*
*/
* 移除选中组件
*
* @date 2014-12-21-下午6:24:16
*/
public void removeEditor() {
if (this.isCellEditing()) {
this.removeCellEditor();
@ -1199,12 +1153,10 @@ public class Grid extends BaseGridComponent {
}
/**
* 移除单元格组件
*
*
* @date 2014-12-21-下午6:24:00
*
*/
* 移除单元格组件
*
* @date 2014-12-21-下午6:24:00
*/
public void removeCellEditor() {
CellEditor cellEditor = getCellEditor();
if (cellEditor == null) {
@ -1233,12 +1185,10 @@ public class Grid extends BaseGridComponent {
}
/**
* 移除悬浮元素组件
*
*
* @date 2014-12-21-下午6:23:38
*
*/
* 移除悬浮元素组件
*
* @date 2014-12-21-下午6:23:38
*/
public void removeFloatEditor() {
FloatEditor floatEditor = getFloatEditor();
if (floatEditor != null) {
@ -1290,31 +1240,24 @@ public class Grid extends BaseGridComponent {
// /////////////editor end
/**
* 鼠标点击事件
*
* @param evtX x坐标
* @param evtY y坐标
*
*
* @date 2014-12-21-下午6:22:56
*
*/
* 鼠标点击事件
*
* @param evtX x坐标
* @param evtY y坐标
* @date 2014-12-21-下午6:22:56
*/
public void doMousePress(double evtX, double evtY) {
dispatchEvent(new MouseEvent(this, MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), 0, (int) evtX, (int) evtY, 1, false));
}
/**
* 计算oldRectangle,因为CellElement的合并会变成多大的区域.
*
* @param report 当前格子报表
* @param oldRectangle 之前的选中区域
*
* @return 插入的区域
*
*
* @date 2014-12-21-下午6:22:21
*
*/
*
* @param report 当前格子报表
* @param oldRectangle 之前的选中区域
* @return 插入的区域
* @date 2014-12-21-下午6:22:21
*/
public Rectangle caculateIntersectsUnion(ElementCase report, Rectangle oldRectangle) {
Rectangle newRectangle = new Rectangle(oldRectangle);

4
designer/src/com/fr/grid/GridHeader.java

@ -1,5 +1,7 @@
package com.fr.grid;
import com.fr.design.constants.UIConstants;
import java.awt.*;
@ -7,7 +9,7 @@ public abstract class GridHeader<T> extends BaseGridComponent {
public final static int SIZE_ADJUST = 4;
//属性
private Color separatorLineColor = new Color(172, 168, 153); //separator lines
private Color separatorLineColor = UIConstants.RULER_LINE_COLOR; //separator lines
private Color selectedForeground = Color.black;
private Color selectedBackground = new Color(208, 240, 252);

3
designer/src/com/fr/poly/creator/ECBlockEditor.java

@ -47,6 +47,9 @@ public class ECBlockEditor extends BlockEditor<ECBlockPane, PolyECBlock> {
@Override
public void targetModified(TargetModifiedEvent e) {
designer.fireTargetModified();
if (DesignerContext.isRefreshOnTargetModifiedEnabled()) {
resetSelectionAndChooseState();
}
}
});
}

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

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

171
designer/src/com/fr/start/Designer.java

@ -135,32 +135,31 @@ public class Designer extends BaseDesigner {
public UILargeToolbar createLargeToolbar() {
UILargeToolbar largeToolbar = super.createLargeToolbar();
largeToolbar.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 4));
JPanel templeJpanel = new JPanel() {
public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize();
dim.width = 1;
return dim;
}
};
templeJpanel.setBackground(Color.WHITE);
largeToolbar.add(templeJpanel);
largeToolbar.add(generateEmptyGap(1));
createRunButton(largeToolbar);
largeToolbar.add(run);
templeJpanel = new JPanel() {
run.setBackground(Color.WHITE);
largeToolbar.add(generateEmptyGap(GAP));
largeToolbar.addSeparator(new Dimension(2, 42));
largeToolbar.setBorder(new MatteBorder(new Insets(0, 0, 1, 0), UIConstants.LINE_COLOR));
return largeToolbar;
}
private JPanel generateEmptyGap(final int width) {
JPanel panel = new JPanel() {
public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize();
dim.width = GAP;
dim.width = width;
return dim;
}
};
templeJpanel.setBackground(Color.WHITE);
largeToolbar.add(templeJpanel);
largeToolbar.setBorder(new MatteBorder(new Insets(0, 0, 1, 0), UIConstants.LINE_COLOR));
return largeToolbar;
panel.setBackground(Color.WHITE);
return panel;
}
/**
* 创建上面一排的工具栏按钮
*
* @return 按钮
*/
public UIButton[] createUp() {
@ -292,9 +291,10 @@ public class Designer extends BaseDesigner {
/**
* 生成工具栏
*
* @param toolbarComponent 工具栏
* @param plus 对象
* @return 更新后的toolbar
* @return 更新后的toolbar
*/
public JComponent resetToolBar(JComponent toolbarComponent, ToolBarMenuDockPlus plus) {
//如果是处于权限编辑状态
@ -335,14 +335,13 @@ public class Designer extends BaseDesigner {
}
/**
* 创建论坛登录面板, chart那边不需要
*
* @return 面板组件
*
*/
public Component createBBSLoginPane(){
if (userInfoPane == null){
userInfoPane = new UserInfoPane();
* 创建论坛登录面板, chart那边不需要
*
* @return 面板组件
*/
public Component createBBSLoginPane() {
if (userInfoPane == null) {
userInfoPane = new UserInfoPane();
}
return userInfoPane;
}
@ -352,7 +351,7 @@ public class Designer extends BaseDesigner {
*
* @return 面板组件
*/
public Component createAlphafinePane() {
public Component createAlphaFinePane() {
return AlphaFinePane.getAlphaFinePane();
}
@ -362,65 +361,64 @@ public class Designer extends BaseDesigner {
}
/**
* 收集用户信息吗
*
*/
* 收集用户信息吗
*/
protected void collectUserInformation() {
//定制的就不弹出来了
if (!ComparatorUtils.equals(ProductConstants.APP_NAME, ProductConstants.DEFAULT_APPNAME)) {
return;
}
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
final String key = envManager.getActivationKey();
//本地验证通过
if(ActiveKeyGenerator.localVerify(key)){
onLineVerify(envManager, key);
UserInfoLabel.showBBSDialog();
return;
}
if(StableUtils.checkDesignerActive(readOldKey())){
//只要有老的key, 就不弹窗, 下次启动的时候, 在线验证下就行.
String newKey = ActiveKeyGenerator.generateActiveKey();
envManager.setActivationKey(newKey);
UserInfoLabel.showBBSDialog();
return;
}
//定制的就不弹出来了
if (!ComparatorUtils.equals(ProductConstants.APP_NAME, ProductConstants.DEFAULT_APP_NAME)) {
return;
}
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
final String key = envManager.getActivationKey();
//本地验证通过
if (ActiveKeyGenerator.localVerify(key)) {
onLineVerify(envManager, key);
UserInfoLabel.showBBSDialog();
return;
}
if (StableUtils.checkDesignerActive(readOldKey())) {
//只要有老的key, 就不弹窗, 下次启动的时候, 在线验证下就行.
String newKey = ActiveKeyGenerator.generateActiveKey();
envManager.setActivationKey(newKey);
UserInfoLabel.showBBSDialog();
return;
}
CollectUserInformationDialog activeDialog = new CollectUserInformationDialog(
DesignerContext.getDesignerFrame());
DesignerContext.getDesignerFrame());
activeDialog.setVisible(true);
}
private void onLineVerify(DesignerEnvManager envManager, final String key){
int status = envManager.getActiveKeyStatus();
//没有联网验证过
if (status != 0) {
Thread authThread = new Thread(new Runnable() {
@Override
public void run() {
ActiveKeyGenerator.onLineVerify(key);
}
});
authThread.start();
}
private void onLineVerify(DesignerEnvManager envManager, final String key) {
int status = envManager.getActiveKeyStatus();
//没有联网验证过
if (status != 0) {
Thread authThread = new Thread(new Runnable() {
@Override
public void run() {
ActiveKeyGenerator.onLineVerify(key);
}
});
authThread.start();
}
}
private File getOldEnvFile(String folderName){
String userHome = System.getProperty("user.home");
if (userHome == null) {
userHome = System.getProperty("userHome");
}
String filePath = StableUtils.pathJoin(userHome, folderName, ProductConstants.APP_NAME + "Env.xml");
private File getOldEnvFile(String folderName) {
String userHome = System.getProperty("user.home");
if (userHome == null) {
userHome = System.getProperty("userHome");
}
String filePath = StableUtils.pathJoin(userHome, folderName, ProductConstants.APP_NAME + "Env.xml");
return new File(filePath);
}
private String getOldActiveKeyFromFile(File envFile){
private String getOldActiveKeyFromFile(File envFile) {
if (!envFile.exists()) {
return StringUtils.EMPTY;
}
return StringUtils.EMPTY;
}
DesignerEnvManager temp = new DesignerEnvManager();
try {
@ -432,24 +430,23 @@ public class Designer extends BaseDesigner {
}
//默认只从7.0和711的设计器里读取key
private String readOldKey(){
File file71 = getOldEnvFile(OLD_ENV_FOLDER_71);
if (!file71.exists()) {
File file70 = getOldEnvFile(OLD_ENV_FOLDER_70);
return getOldActiveKeyFromFile(file70);
}
return getOldActiveKeyFromFile(file71);
private String readOldKey() {
File file71 = getOldEnvFile(OLD_ENV_FOLDER_71);
if (!file71.exists()) {
File file70 = getOldEnvFile(OLD_ENV_FOLDER_70);
return getOldActiveKeyFromFile(file70);
}
return getOldActiveKeyFromFile(file71);
}
/**
* 设计器退出时, 做的一些操作.
*
*/
public void shutDown(){
InformationCollector collector = InformationCollector.getInstance();
collector.collectStopTime();
collector.saveXMLFile();
* 设计器退出时, 做的一些操作.
*/
public void shutDown() {
InformationCollector collector = InformationCollector.getInstance();
collector.collectStopTime();
collector.saveXMLFile();
ServletContext.fireServletStopListener();
}

162
designer_base/src/com/fr/design/DesignerEnvManager.java

@ -13,22 +13,47 @@ import com.fr.design.constants.UIConstants;
import com.fr.env.RemoteEnv;
import com.fr.env.SignIn;
import com.fr.file.FILEFactory;
import com.fr.general.*;
import com.fr.stable.*;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLevel;
import com.fr.general.FRLogFormatter;
import com.fr.general.FRLogger;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.stable.Constants;
import com.fr.stable.EnvChangedListener;
import com.fr.stable.ListMap;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.core.UUID;
import com.fr.stable.project.ProjectConstants;
import com.fr.stable.xml.*;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLReadable;
import com.fr.stable.xml.XMLTools;
import com.fr.stable.xml.XMLWriter;
import com.fr.stable.xml.XMLableReader;
import org.apache.log4j.Level;
import javax.swing.*;
import javax.swing.SwingWorker.StateValue;
import java.awt.*;
import java.io.*;
import java.util.*;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStream;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.FileHandler;
import java.util.logging.Handler;
import org.apache.log4j.Level;
/**
* The manager of Designer GUI.
@ -36,6 +61,7 @@ import org.apache.log4j.Level;
public class DesignerEnvManager implements XMLReadable, XMLWriter {
private static final int MAX_SHOW_NUM = 10;
private static final String VERSION_80 = "80";
private static DesignerEnvManager designerEnvManager; // gui.
private String activationKey = null;
@ -219,9 +245,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
calender.setTimeInMillis(System.currentTimeMillis());
String today = calender.get(Calendar.YEAR) + "-" + (calender.get(Calendar.MONTH) + 1) + "-" + calender.get(Calendar.DAY_OF_MONTH);
String fileName = StableUtils.pathJoin(new String[]{
logLocation, "fr_" + today + "_%g.log"
});
String fileName = StableUtils.pathJoin(logLocation, "fr_" + today + "_%g.log");
if (!new java.io.File(fileName).exists()) {
StableUtils.makesureFileExist(new java.io.File(fileName));
}
@ -253,11 +277,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
try {
FileWriter fileWriter = new FileWriter(envFile);
File oldEnvFile = new File(ProductConstants.getEnvHome() + File.separator + ProductConstants.APP_NAME + "6-1" + "Env.xml");
File envFile80 = new File(getEnvHome(VERSION_80) + File.separator + getEnvFile().getName());
if (oldEnvFile.exists()) {
// marks:兼容DesignerEnv6-1.xml
FileReader fileReader = new FileReader(oldEnvFile);
Utils.copyCharTo(fileReader, fileWriter);
fileReader.close();
} else if (envFile80.exists()) {
compatibilityPrevVersion(envFile80);
} else {
// marks:生成一个新的xml文件
StringReader stringReader = new StringReader("<?xml version=\"1.0\" encoding=\"UTF-8\" ?><Env></Env>");
@ -270,6 +297,33 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
}
private static String getEnvHome(String version) {
String userHome = System.getProperty("user.home");
if (userHome == null) {
userHome = System.getProperty("userHome");
}
File envHome = new File(userHome + File.separator + "." + ProductConstants.APP_NAME + version);
if (!envHome.exists()) {
StableUtils.mkdirs(envHome);
}
return envHome.getAbsolutePath();
}
private void compatibilityPrevVersion(File prevEnvFile) {
try {
XMLTools.readFileXML(designerEnvManager, prevEnvFile);
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}
// 清空前一个版本中的工作目录和最近打开
nameEnvMap = new ListMap<String, Env>();
recentOpenedFilePathList = new ArrayList<String>();
curEnvName = null;
designerEnvManager.saveXMLFile();
}
public static void setEnvFile(File envFile) {
DesignerEnvManager.envFile = envFile;
}
@ -285,6 +339,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
/**
* 是否启用了https
*
* @return 同上
*/
public boolean isHttps() {
@ -311,7 +366,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
return certificatePass;
}
public void setCertificatePass(String certificatePass){
public void setCertificatePass(String certificatePass) {
this.certificatePass = certificatePass;
}
@ -531,13 +586,13 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.reportLengthUnit = reportLengthUnit;
}
private void writeTempFile(File tempFile){
try{
private void writeTempFile(File tempFile) {
try {
OutputStream fout = new FileOutputStream(tempFile);
XMLTools.writeOutputStreamXML(this, fout);
fout.flush();
fout.close();
}catch (Exception e) {
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage());
}
}
@ -546,9 +601,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
* 保存设计器的配置文件, 该文件不在env的resource目录下
* 而是在Consts.getEnvHome() + File.separator + Consts.APP_NAME
*
*
* @date 2014-9-29-上午11:04:23
*
*/
public void saveXMLFile() {
File xmlFile = this.getDesignerEnvFile();
@ -577,7 +630,6 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
* 是否加入产品改良
*
* @return 是否加入产品改良
*
*/
public boolean isJoinProductImprove() {
return joinProductImprove;
@ -585,7 +637,6 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
/**
* 设置加入产品改良
*
*/
public void setJoinProductImprove(boolean joinProductImprove) {
this.joinProductImprove = joinProductImprove;
@ -1155,63 +1206,63 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.lastShowBBSNewsTime = lastShowBBSNewsTime;
}
private void readXMLVersion(XMLableReader reader){
private void readXMLVersion(XMLableReader reader) {
String tmpVal;
if ((tmpVal = reader.getElementValue()) != null) {
reader.setXmlVersionByString(tmpVal);
}
}
private void readActiveKey(XMLableReader reader){
private void readActiveKey(XMLableReader reader) {
String tmpVal;
if ((tmpVal = reader.getElementValue()) != null) {
this.setActivationKey(tmpVal);
}
}
private void readLogLocation(XMLableReader reader){
private void readLogLocation(XMLableReader reader) {
String tmpVal;
if ((tmpVal = reader.getElementValue()) != null) {
this.setLogLocation(tmpVal);
}
}
private void readLanguage(XMLableReader reader){
private void readLanguage(XMLableReader reader) {
String tmpVal;
if ((tmpVal = reader.getElementValue()) != null) {
this.setLanguage(Integer.parseInt(tmpVal));
}
}
private void readJettyPort(XMLableReader reader){
private void readJettyPort(XMLableReader reader) {
String tmpVal;
if ((tmpVal = reader.getElementValue()) != null) {
this.setJettyServerPort(Integer.parseInt(tmpVal));
}
}
private void readPageLengthUnit(XMLableReader reader){
private void readPageLengthUnit(XMLableReader reader) {
String tmpVal;
if (StringUtils.isNotBlank(tmpVal = reader.getElementValue())) {
this.pageLengthUnit = Short.parseShort(tmpVal);
}
}
private void readReportLengthUnit(XMLableReader reader){
private void readReportLengthUnit(XMLableReader reader) {
String tmpVal;
if (StringUtils.isNotBlank(tmpVal = reader.getElementValue())) {
this.reportLengthUnit = Short.parseShort(tmpVal);
}
}
private void readLastOpenFile(XMLableReader reader){
private void readLastOpenFile(XMLableReader reader) {
String tmpVal;
if (StringUtils.isNotBlank(tmpVal = reader.getElementValue())) {
this.lastOpenFilePath = tmpVal;
}
}
private void readEncrytionKey(XMLableReader reader){
private void readEncrytionKey(XMLableReader reader) {
String tmpVal;
if (StringUtils.isNotBlank(tmpVal = reader.getElementValue())) {
this.encryptionKey = tmpVal;
@ -1219,15 +1270,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
private void readLastBBSTime(XMLableReader reader){
private void readLastBBSTime(XMLableReader reader) {
String tmpVal;
if (StringUtils.isNotBlank(tmpVal = reader.getElementValue())) {
this.lastShowBBSTime = tmpVal;
}
}
private void readLastBBSNewsTime(XMLableReader reader){
private void readLastBBSNewsTime(XMLableReader reader) {
String tmpVal;
if (StringUtils.isNotBlank(tmpVal = reader.getElementValue())) {
this.lastShowBBSNewsTime = tmpVal;
@ -1275,15 +1325,15 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
readEncrytionKey(reader);
} else if ("jdkHome".equals(name)) {
this.jdkHome = reader.getElementValue();
}else if ("lastBBSTime".equals(name)){
} else if ("lastBBSTime".equals(name)) {
readLastBBSTime(reader);
} else if ("lastBBSNewsTime".equals(name)){
} else if ("lastBBSNewsTime".equals(name)) {
readLastBBSNewsTime(reader);
}else if ("uuid".equals(name)){
} else if ("uuid".equals(name)) {
readUUID(reader);
} else if ("status".equals(name)){
} else if ("status".equals(name)) {
readActiveStatus(reader);
} else if (ComparatorUtils.equals(CAS_PARAS,name)){
} else if (ComparatorUtils.equals(CAS_PARAS, name)) {
readHttpsParas(reader);
} else if (name.equals("AlphaFineConfigManager")) {
readAlphaFineAttr(reader);
@ -1297,12 +1347,12 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
reader.readXMLObject(this.alphaFineConfigManager = new AlphaFineConfigManager());
}
private void readHttpsParas(XMLableReader reader){
private void readHttpsParas(XMLableReader reader) {
String tempVal;
if((tempVal = reader.getAttrAsString(CAS_CERTIFICATE_PATH, null)) != null){
if ((tempVal = reader.getAttrAsString(CAS_CERTIFICATE_PATH, null)) != null) {
this.setCertificatePath(tempVal);
}
if((tempVal = reader.getAttrAsString(CAS_CERTIFICATE_PASSWORD, null)) != null){
if ((tempVal = reader.getAttrAsString(CAS_CERTIFICATE_PASSWORD, null)) != null) {
this.setCertificatePass(tempVal);
}
@ -1429,18 +1479,6 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
}
});
// xml读完之后,看一下nameEnvMap是不是长度为0
if (nameEnvMap.isEmpty() && StableUtils.getInstallHome() != null) {
String install_home = StableUtils.getInstallHome();
if (install_home != null && new java.io.File(install_home).exists()) {
nameEnvMap.put("Default", LocalEnv.createEnv(StableUtils.pathJoin(new String[]{
install_home, ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME
})));
curEnvName = "Default";
}
}
}
private void readRecentOpenFileList(XMLableReader reader) {
@ -1519,14 +1557,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
//写入uuid
private void writeUUID(XMLPrintWriter writer){
private void writeUUID(XMLPrintWriter writer) {
writer.startTAG("uuid");
writer.textNode(getUUID());
writer.end();
}
//读取uuid
private void readUUID(XMLableReader reader){
private void readUUID(XMLableReader reader) {
String tmpVal;
if (StringUtils.isNotBlank(tmpVal = reader.getElementValue())) {
this.uuid = tmpVal;
@ -1534,8 +1572,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
//写入激活状态
private void writeActiveStatus(XMLPrintWriter writer){
if (this.activeKeyStatus == 0){
private void writeActiveStatus(XMLPrintWriter writer) {
if (this.activeKeyStatus == 0) {
writer.startTAG("status");
writer.textNode(this.activeKeyStatus + "");
writer.end();
@ -1543,7 +1581,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
//读取激活状态
private void readActiveStatus(XMLableReader reader){
private void readActiveStatus(XMLableReader reader) {
String tmpVal;
if (StringUtils.isNotBlank(tmpVal = reader.getElementValue())) {
this.activeKeyStatus = Integer.parseInt(tmpVal);
@ -1596,7 +1634,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if (!this.isOracleSystemSpace()) {
writer.attr("useOracleSystemSpace", this.isOracleSystemSpace());
}
if (!this.isJoinProductImprove()){
if (!this.isJoinProductImprove()) {
writer.attr("joinProductImprove", this.isJoinProductImprove());
}
if (!this.isAutoBackUp()) {
@ -1681,29 +1719,29 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
//写论坛相关的两个属性
private void writeBBSRelated(XMLPrintWriter writer){
if (StringUtils.isNotEmpty(this.lastShowBBSTime)){
private void writeBBSRelated(XMLPrintWriter writer) {
if (StringUtils.isNotEmpty(this.lastShowBBSTime)) {
writer.startTAG("lastBBSTime");
writer.textNode(lastShowBBSTime);
writer.end();
}
if (StringUtils.isNotEmpty(this.lastShowBBSNewsTime)){
if (StringUtils.isNotEmpty(this.lastShowBBSNewsTime)) {
writer.startTAG("lastBBSNewsTime");
writer.textNode(lastShowBBSNewsTime);
writer.end();
}
}
private void writeHttpsParas(XMLPrintWriter writer){
private void writeHttpsParas(XMLPrintWriter writer) {
writer.startTAG(CAS_PARAS);
if(StringUtils.isNotBlank(certificatePath)){
if (StringUtils.isNotBlank(certificatePath)) {
writer.attr(CAS_CERTIFICATE_PATH, certificatePath);
}
if(StringUtils.isNotBlank(certificatePass)){
if (StringUtils.isNotBlank(certificatePass)) {
writer.attr(CAS_CERTIFICATE_PASSWORD, certificatePass);
}
if(isHttps){
if (isHttps) {
writer.attr("enable", true);
}
writer.end();

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

@ -2,6 +2,7 @@ package com.fr.design.actions;
import com.fr.design.designer.TargetComponent;
import com.fr.design.mainframe.DesignerContext;
public abstract class TemplateComponentAction<T extends TargetComponent> extends UndoableAction implements TemplateComponentActionInterface<T> {
private T t;
@ -24,6 +25,7 @@ public abstract class TemplateComponentAction<T extends TargetComponent> extends
@Override
public void prepare4Undo() {
DesignerContext.enableRefreshOnTargetModified();
this.getEditingComponent().fireTargetModified();
T component = getEditingComponent();
if (component == null) {

44
designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java

@ -1,5 +1,6 @@
package com.fr.design.actions.help.alphafine;
import com.fr.base.FRContext;
import com.fr.base.FRCoreContext;
import com.fr.general.VT4FR;
import com.fr.stable.OperatingSystem;
@ -15,79 +16,68 @@ import javax.swing.*;
*/
public class AlphaFineConfigManager implements XMLable {
private static AlphaFineConfigManager alphaFineConfigManager = new AlphaFineConfigManager();
/**
* 是否开启alphafine
*/
private boolean isEnabled = true;
/**
* 是否联网搜索
*/
private boolean isSearchOnLine = true;
/**
* 快捷键设置
* 搜索范围
*/
private String shortcuts;
/**
* 搜索范围
* 快捷键设置
*/
private String shortcuts;
/**
* 猜您需要
*/
private boolean isContainRecommend = true;
/**
* 设置
*/
private boolean isContainAction = true;
/**
* 帮助文档
*/
private boolean isContainDocument = true;
/**
* 模板
*/
private boolean isContainTemplate = true;
/**
* 模板内容
*/
private boolean isContainFileContent;
/**
* 应用中心
*/
private boolean isContainPlugin = true;
/**
* 快捷键
*/
private KeyStroke shortCutKeyStore;
/**
* 是否提醒
*/
private boolean isNeedRemind = true;
/**
* 直接操作菜单次数
*/
private int operateCount;
private static AlphaFineConfigManager alphaFineConfigManager = new AlphaFineConfigManager();
public static AlphaFineConfigManager getInstance() {
return alphaFineConfigManager;
}
public static boolean isALPHALicAvailable() {
return FRContext.getCurrentEnv() != null && VT4FR.isLicAvailable(FRCoreContext.getBytes()) && VT4FR.ALPHA_FINE.support();
}
@Override
public Object clone() throws CloneNotSupportedException {
AlphaFineConfigManager manager = (AlphaFineConfigManager) super.clone();
@ -130,8 +120,6 @@ public class AlphaFineConfigManager implements XMLable {
writer.end();
}
public boolean isSearchOnLine() {
return isSearchOnLine;
}
@ -147,20 +135,20 @@ public class AlphaFineConfigManager implements XMLable {
return shortcuts;
}
public void setShortcuts(String shortcuts) {
this.shortcuts = shortcuts;
this.shortCutKeyStore = convert2KeyStroke(this.shortcuts);
}
/**
* 返回默认快捷键
*
* @return
*/
private String getDefaultShortCuts() {
return OperatingSystem.isMacOS()? "meta + D" : "ctrl + D";
return OperatingSystem.isMacOS() ? "meta + D" : "ctrl + D";
}
public void setShortcuts(String shortcuts) {
this.shortcuts = shortcuts;
this.shortCutKeyStore = convert2KeyStroke(this.shortcuts);
}
public boolean isContainAction() {
return isContainAction;
}

2
designer_base/src/com/fr/design/actions/server/PlatformManagerAction.java

@ -15,7 +15,7 @@ public class PlatformManagerAction extends UpdateAction {
this.setMenuKeySet(PLATEFORM_MANAGER);
this.setName(getMenuKeySet().getMenuKeySetName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/web/images/platform/platform_16_16.png"));
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/server/platform_16_16.png"));
}
/**

11
designer_base/src/com/fr/design/condition/LiteConditionPane.java

@ -69,6 +69,7 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
private static final int DOWN_PADDING = 4;
private static final int STRUT_ONE = 35;
private static final int STRUT_TWO = 4;
private static final int ADD_CONTROL_PANE_PADDING_RIGHT = -5;
private ActionListener actionListener1 = new ActionListener() {
@ -537,8 +538,14 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
private void initControlPane(JPanel controlPane) {
JPanel addControlPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();
controlPane.add(addControlPane, BorderLayout.SOUTH);
addControlPane.setBorder(new ModLineBorder(ModLineBorder.TOP));
addControlPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, ADD_CONTROL_PANE_PADDING_RIGHT));
JPanel splitPane = new JPanel();
splitPane.setBorder(new ModLineBorder(ModLineBorder.TOP));
JPanel addControlPaneWrapper = new JPanel(new BorderLayout());
addControlPaneWrapper.add(addControlPane, BorderLayout.CENTER);
addControlPaneWrapper.add(splitPane, BorderLayout.NORTH);
controlPane.add(addControlPaneWrapper, BorderLayout.SOUTH);
ButtonGroup bg = new ButtonGroup();
bg.add(andRadioButton);

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

@ -64,6 +64,7 @@ public interface UIConstants {
Constants.LINE_MEDIUM_DASH_DOT_DOT, //medium dash-dot-dot border
Constants.LINE_SLANTED_DASH_DOT, //slanted dash-dot border
};
public static final Color TOOLBAR_BORDER_COLOR = new Color(0xD9DADD);
public static final Color COMBOBOX_BTN_NORMAL = new Color(0xD9DADD);
public static final Color COMBOBOX_BTN_ROLLOVER = new Color(0xC8C9CD);
public static final Color COMBOBOX_BTN_PRESS = new Color(0xD8F2FD);
@ -74,7 +75,7 @@ public interface UIConstants {
public static final Color OCEAN_BLUE = new Color(141, 179, 217);
public static final Color DARK_BLUE = new Color(0, 88, 144);
public static final Color NORMAL_BACKGROUND = new Color(212, 212, 216);
public static final Color TREE_BACKGROUND = new Color(240, 240, 243);
public static final Color TREE_BACKGROUND = new Color(245, 245, 247);
public static final Color TOOL_PANE_BACKGROUND = new Color(232, 232, 223);
public static final Color SELECT_TAB = new Color(245, 245, 247);
public static final Color TOOLBARUI_BACKGROUND = new Color(255, 255, 255);
@ -102,11 +103,11 @@ public interface UIConstants {
public static final Color SELECTED_BACKGROUND = new Color(0xdeedfe);
public static final Color SELECTED_BORDER_LINE_COLOR = new Color(0x3384f0);
public static final Color DEFAULT_BG_RULER = new Color(0xffffff);
public static final Color RULER_LINE_COLOR = new Color(0xababab);
public static final Color RULER_LINE_COLOR = new Color(0xD9DADD);
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 TITLED_BORDER_COLOR = new Color(0xe8e8e9);
public static final Color POP_DIALOG_BORDER = new Color(218, 218, 221);
public static final Color PROPERTY_DIALOG_BORDER = new Color(0xc9c9cd);
public static final Color TAB_BUTTON_HOVER = new Color(231, 230, 235);
@ -114,6 +115,7 @@ public interface UIConstants {
public static final Color TAB_BUTTON_PRESS = new Color(228, 227, 232);
public static final Color TAB_BUTTON_PRESS_SELECTED = new Color(236, 236, 238);
public static final Color POPUP_TITLE_BACKGROUND = new Color(0xd8f2fd);
public static final Color LIST_ITEM_SPLIT_LINE = new Color(0xf0f0f3);
@ -129,6 +131,7 @@ public interface UIConstants {
public static final BufferedImage DRAG_LEFT_NORMAL = BaseUtils.readImage("com/fr/design/images/control/leftnor.png");
public static final BufferedImage DRAG_LEFT_PRESS = BaseUtils.readImage("com/fr/design/images/control/leftpre.png");
public static final BufferedImage DRAG_DOT = BaseUtils.readImage("com/fr/design/images/control/dot.png");
public static final BufferedImage ACCESSIBLE_EDITOR_DOT = BaseUtils.readImage("com/fr/design/images/control/dot.png");
public static final BufferedImage DRAG_DOT_VERTICAL = BaseUtils.readImage("com/fr/design/images/control/dotv.png");
public static final BufferedImage POP_BUTTON_DOWN = BaseUtils.readImage("com/fr/design/images/buttonicon/popdownarrow.png");
public static final BufferedImage POP_BUTTON_UP = BaseUtils.readImage("com/fr/design/images/buttonicon/popuparrow.png");

55
designer_base/src/com/fr/design/data/DesignTableDataManager.java

@ -6,19 +6,24 @@ import com.fr.base.StoreProcedureParameter;
import com.fr.base.TableData;
import com.fr.data.TableDataSource;
import com.fr.data.core.DataCoreXmlUtils;
import com.fr.design.data.datapane.preview.PreviewTablePane;
import com.fr.data.impl.EmbeddedTableData;
import com.fr.data.impl.storeproc.ProcedureDataModel;
import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.data.impl.storeproc.StoreProcedureConstants;
import com.fr.design.data.tabledata.wrapper.*;
import com.fr.design.DesignModelAdapter;
import com.fr.design.data.datapane.preview.PreviewTablePane;
import com.fr.design.data.tabledata.wrapper.ServerTableDataWrapper;
import com.fr.design.data.tabledata.wrapper.StoreProcedureDataWrapper;
import com.fr.design.data.tabledata.wrapper.StoreProcedureNameWrapper;
import com.fr.design.data.tabledata.wrapper.TableDataFactory;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.iprogressbar.AutoProgressBar;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.parameter.ParameterInputPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.file.DatasourceManager;
import com.fr.file.DatasourceManagerProvider;
import com.fr.general.ComparatorUtils;
@ -34,8 +39,16 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.io.ByteArrayOutputStream;
import java.text.Collator;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Timer;
import java.util.TimerTask;
/**
* 设计器管理操作数据集的类:
@ -351,7 +364,20 @@ public abstract class DesignTableDataManager {
* @throws Exception 异常
*/
public static EmbeddedTableData previewTableDataNeedInputParameters(TableData tabledata, int rowCount, boolean needLoadingBar) throws Exception {
return previewTableData(tabledata, rowCount, true, needLoadingBar);
return previewTableData(null, tabledata, rowCount, true, needLoadingBar);
}
/**
* 预览需要参数的数据集
*
* @param tabledata 数据集
* @param rowCount 需要预览的行数
* @param needLoadingBar 是否需要加载进度条
* @return 数据集
* @throws Exception 异常
*/
public static EmbeddedTableData previewTableDataNeedInputParameters(TableDataSource tableDataSource, TableData tabledata, int rowCount, boolean needLoadingBar) throws Exception {
return previewTableData(tableDataSource, tabledata, rowCount, true, needLoadingBar);
}
/**
@ -364,7 +390,20 @@ public abstract class DesignTableDataManager {
* @throws Exception 异常
*/
public static EmbeddedTableData previewTableDataNotNeedInputParameters(TableData tabledata, int rowCount, boolean needLoadingBar) throws Exception {
return previewTableData(tabledata, rowCount, false, needLoadingBar);
return previewTableData(null, tabledata, rowCount, false, needLoadingBar);
}
/**
* 预览不需要参数的数据集
*
* @param tabledata 数据集
* @param rowCount 需要预览的行数
* @param needLoadingBar 是否需要加载进度条
* @return 数据集
* @throws Exception 异常
*/
public static EmbeddedTableData previewTableDataNotNeedInputParameters(TableDataSource tableDataSource, TableData tabledata, int rowCount, boolean needLoadingBar) throws Exception {
return previewTableData(tableDataSource, tabledata, rowCount, false, needLoadingBar);
}
/**
@ -376,7 +415,7 @@ public abstract class DesignTableDataManager {
* 而获取数据集的字段名字时则没必要
* @return
*/
private static EmbeddedTableData previewTableData(TableData tabledata, int rowCount, boolean isMustInputParameters, boolean needLoadingBar) throws Exception {
private static EmbeddedTableData previewTableData(TableDataSource tableDataSource, TableData tabledata, int rowCount, boolean isMustInputParameters, boolean needLoadingBar) throws Exception {
final AutoProgressBar loadingBar = PreviewTablePane.getInstance().getProgressBar();
Env currentEnv = FRContext.getCurrentEnv();
ParameterProvider[] parameters = currentEnv.getTableDataParameters(tabledata);
@ -406,7 +445,7 @@ public abstract class DesignTableDataManager {
parameter.setValue(parameterMap.get(parameter.getName()));
}
}
return currentEnv.previewTableData(tabledata, parameterMap, rowCount);
return currentEnv.previewTableData(tableDataSource, tabledata, parameterMap, rowCount);
} catch (TableDataException e) {
throw new TableDataException(e.getMessage(), e);
} finally {

3
designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java

@ -6,6 +6,7 @@ import com.fr.data.TableDataSource;
import com.fr.design.DesignModelAdapter;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.UpdateAction;
import com.fr.design.constants.UIConstants;
import com.fr.design.data.BasicTableDataTreePane;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.tabledata.StoreProcedureWorkerListener;
@ -111,6 +112,8 @@ public class TableDataTreePane extends BasicTableDataTreePane {
ToolBarDef toolbarDef = new ToolBarDef();
toolbarDef.addShortCut(addMenuDef, SeparatorDef.DEFAULT, editAction, removeAction, SeparatorDef.DEFAULT, previewTableDataAction, connectionTableAction);
UIToolbar toolBar = ToolBarDef.createJToolBar();
toolBar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.TOOLBAR_BORDER_COLOR));
toolBar.setBorderPainted(true);
toolbarDef.updateToolBar(toolBar);
JPanel toolbarPane = FRGUIPaneFactory.createBorderLayout_S_Pane();

13
designer_base/src/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java

@ -1,6 +1,8 @@
package com.fr.design.data.datapane.connect;
import com.fr.base.BaseUtils;
import com.fr.data.impl.AbstractDatabaseConnection;
import com.fr.data.impl.Connection;
import com.fr.design.constants.UIConstants;
import com.fr.data.core.db.TableProcedure;
import com.fr.design.border.UIRoundedBorder;
@ -20,6 +22,7 @@ import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.awt.*;
import java.awt.event.*;
import java.util.List;
/**
* 数据集编辑面板左边的部分
@ -39,6 +42,12 @@ public class ConnectionTableProcedurePane extends BasicPane {
public ConnectionTableProcedurePane() {
this.setLayout(new BorderLayout(4, 4));
connectionComboBox = new ConnectionComboBoxPanel(com.fr.data.impl.Connection.class) {
@Override
protected void filterConnection(Connection connection, String conName, List<String> nameList) {
filter(connection, conName, nameList);
}
protected void refreshItems() {
super.refreshItems();
if (tableViewList != null) {
@ -83,6 +92,10 @@ public class ConnectionTableProcedurePane extends BasicPane {
this.setPreferredSize(new Dimension(WIDTH, getPreferredSize().height));
}
protected void filter(Connection connection, String conName, List<String> nameList) {
connection.addConnection(nameList, conName, new Class[]{AbstractDatabaseConnection.class});
}
protected JPanel createCheckBoxgroupPane() {
JPanel checkBoxgroupPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(2);
JPanel first = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();

5
designer_base/src/com/fr/design/data/datapane/preview/PreviewTablePane.java

@ -6,6 +6,7 @@ package com.fr.design.data.datapane.preview;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.base.TableData;
import com.fr.data.TableDataSource;
import com.fr.data.impl.DBTableData;
import com.fr.data.impl.EmbeddedTableData;
import com.fr.data.impl.storeproc.ProcedureDataModel;
@ -13,6 +14,7 @@ import com.fr.design.DesignerEnvManager;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.iprogressbar.AutoProgressBar;
@ -362,7 +364,8 @@ public class PreviewTablePane extends BasicPane {
}
}
connectionBar.close();
previewTableData = DesignTableDataManager.previewTableDataNeedInputParameters(tableData, (int) maxPreviewNumberField.getValue(), true);
TableDataSource dataSource = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getTarget();
previewTableData = DesignTableDataManager.previewTableDataNeedInputParameters(dataSource, tableData, (int) maxPreviewNumberField.getValue(), true);
// parameterInputDialog
// update之后的parameters,转成一个parameterMap,用于预览TableData
PreviewTableModel previewModel = new PreviewTableModel(previewTableData.createDataModel(null), (int) maxPreviewNumberField.getValue());

13
designer_base/src/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java

@ -5,7 +5,11 @@ import com.fr.base.FRContext;
import com.fr.base.Parameter;
import com.fr.base.ParameterHelper;
import com.fr.data.core.db.TableProcedure;
import com.fr.data.impl.AbstractDatabaseConnection;
import com.fr.data.impl.Connection;
import com.fr.data.impl.DBTableData;
import com.fr.data.impl.JDBCDatabaseConnection;
import com.fr.data.impl.JNDIDatabaseConnection;
import com.fr.data.impl.NameDatabaseConnection;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.UpdateAction;
@ -37,6 +41,7 @@ import com.fr.script.Calculator;
import com.fr.stable.ArrayUtils;
import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils;
import org.sqlite.JDBC;
import javax.swing.*;
import javax.swing.text.BadLocationException;
@ -102,7 +107,12 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
sqlSplitPane.add(box, BorderLayout.CENTER);
// 左边的Panel,上面是选择DatabaseConnection的ComboBox,下面DatabaseConnection对应的Table
connectionTableProcedurePane = new ConnectionTableProcedurePane();
connectionTableProcedurePane = new ConnectionTableProcedurePane() {
@Override
protected void filter(Connection connection, String conName, List<String> nameList) {
connection.addConnection(nameList, conName, new Class[]{JDBCDatabaseConnection.class, JNDIDatabaseConnection.class});
}
};
connectionTableProcedurePane.addDoubleClickListener(new DoubleClickSelectedNodeOnTreeListener() {
@Override
@ -138,6 +148,7 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
this.add(mainSplitPane, BorderLayout.CENTER);
}
private boolean isPreviewOrRefreshButton (FocusEvent e) {
if (e.getOppositeComponent() != null) {
String name = e.getOppositeComponent().getName();

2
designer_base/src/com/fr/design/data/tabledata/wrapper/AbstractTableDataWrapper.java

@ -58,7 +58,7 @@ public abstract class AbstractTableDataWrapper implements TableDataWrapper {
EmbeddedTableData embeddedTableData = null;
try {
embeddedTableData = DesignTableDataManager.previewTableDataNotNeedInputParameters(tabledata, TableData.RESULT_NOT_NEED, false);
embeddedTableData = DesignTableDataManager.previewTableDataNotNeedInputParameters(tds, tabledata, TableData.RESULT_NOT_NEED, false);
} catch (Exception e) {
if (e.getMessage()!=null) {
DesignUtils.errorMessage(e.getMessage());

10
designer_base/src/com/fr/design/designer/IntervalConstants.java

@ -7,7 +7,7 @@ public class IntervalConstants {
public static final int INTERVAL_L1 = 10;
public static final int INTERVAL_L2 = 15;
public static final int INTERVAL_L2 = 13;
public static final int INTERVAL_L3 = 155;
@ -19,4 +19,12 @@ public class IntervalConstants {
public static final int INTERVAL_L7 = 8;
public static final int INTERVAL_W0 = 3;
public static final int INTERVAL_W1 = 25;
public static final int INTERVAL_W2 = 37;
public static final int INTERVAL_W3 = 49;
}

10
designer_base/src/com/fr/design/designer/TargetComponent.java

@ -1,16 +1,16 @@
package com.fr.design.designer;
import javax.swing.*;
import com.fr.design.DesignState;
import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener;
import com.fr.design.mainframe.AuthorityEditPane;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.DesignState;
import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef;
import com.fr.stable.StringUtils;
import com.fr.design.mainframe.*;
import javax.swing.*;
/**
* 模板设计界面
@ -31,7 +31,7 @@ public abstract class TargetComponent<T> extends JComponent {
public abstract void stopEditing();
public final T getTarget() {
public T getTarget() {
return target;
}

32
designer_base/src/com/fr/design/designer/creator/CRPropertyDescriptor.java

@ -15,14 +15,15 @@ import java.beans.PropertyDescriptor;
*/
public final class CRPropertyDescriptor extends PropertyDescriptor {
public static final String RENDERER = "renderer";
private boolean isSubProperty = false;
private PropertyChangeAdapter l;
private PropertyChangeAdapter l;
public CRPropertyDescriptor(String name, Class<?> beanClass) throws IntrospectionException {
super(name, beanClass);
}
public CRPropertyDescriptor(String name, Class<?> beanClass, String readMethod, String writeMethod) throws IntrospectionException{
public CRPropertyDescriptor(String name, Class<?> beanClass, String readMethod, String writeMethod) throws IntrospectionException {
super(name, beanClass, readMethod, writeMethod);
}
@ -34,16 +35,16 @@ public final class CRPropertyDescriptor extends PropertyDescriptor {
return this;
}
public CRPropertyDescriptor setPropertyChangeListener(PropertyChangeAdapter l) {
this.l = l;
return this;
}
public CRPropertyDescriptor setPropertyChangeListener(PropertyChangeAdapter l) {
this.l = l;
return this;
}
public void firePropertyChanged() {
if (l != null) {
l.propertyChange();
}
}
public void firePropertyChanged() {
if (l != null) {
l.propertyChange();
}
}
public CRPropertyDescriptor setEditorClass(Class<?> clazz) {
this.setPropertyEditorClass(clazz);
@ -59,4 +60,13 @@ public final class CRPropertyDescriptor extends PropertyDescriptor {
this.setDisplayName(displayName);
return this;
}
public CRPropertyDescriptor setSubLevel(boolean isSubProperty) {
this.isSubProperty = isSubProperty;
return this;
}
public boolean isSubLevel() {
return isSubProperty;
}
}

6
designer_base/src/com/fr/design/editor/DoubleDeckValueEditorPane.java

@ -217,9 +217,9 @@ public class DoubleDeckValueEditorPane extends BasicPane implements UIObserver,
String name = currentEditor.getName();
Object columnIndex = currentEditor.getValue();
//bug86542,这边为啥要new一个公式出来,只保留content,其他属性全不要了?
// if (ComparatorUtils.equals(name, Inter.getLocText("Formula"))) {
// columnIndex = new Formula(columnIndex == null ? "" : columnIndex.toString());
// }
if (columnIndex == null && ComparatorUtils.equals(name, Inter.getLocText("Formula"))) {
columnIndex = ((FormulaEditor) currentEditor).getFormula();
}
return columnIndex;
}

24
designer_base/src/com/fr/design/editor/ValueEditorPane.java

@ -2,19 +2,17 @@ package com.fr.design.editor;
import com.fr.base.Formula;
import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.BasicPane;
import com.fr.design.editor.editor.*;
import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIMenuEastAttrItem;
import com.fr.design.gui.imenu.UIPopupEastAttrMenu;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.dialog.BasicPane;
import com.fr.design.editor.editor.ColumnNameEditor;
import com.fr.design.editor.editor.Editor;
import com.fr.design.editor.editor.TextEditor;
import com.fr.design.editor.editor.XMLANameEditor;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.stable.StringUtils;
@ -139,14 +137,14 @@ public class ValueEditorPane extends BasicPane implements UIObserver, GlobalName
private JPopupMenu createPopMenu() {
JPopupMenu scate = new JPopupMenu();
JPopupMenu scate = new UIPopupEastAttrMenu();
if (this.cards == null) {
return scate;
}
for (int i = 0; i < this.cards.length; i++) {
UIMenuItem item = new UIMenuItem(cards[i].getName());
JMenuItem item = new UIMenuEastAttrItem(cards[i].getName());
final int j = i;
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
@ -165,9 +163,6 @@ public class ValueEditorPane extends BasicPane implements UIObserver, GlobalName
}
});
scate.add(item);
if (i < cards.length - 1) {
scate.addSeparator();
}
}
return scate;
}
@ -207,9 +202,10 @@ public class ValueEditorPane extends BasicPane implements UIObserver, GlobalName
String name = currentEditor.getName();
Object columnIndex = currentEditor.getValue();
//bug86542,这边为啥要new一个公式出来,只保留content,其他属性全不要了?
// if (ComparatorUtils.equals(name, Inter.getLocText("Formula"))) {
// columnIndex = new Formula(columnIndex == null ? "" : columnIndex.toString());
// }
//MoMeak:我也想注释了,但是有bug啊。。。
if (columnIndex == null && ComparatorUtils.equals(name, Inter.getLocText("Formula"))) {
columnIndex = ((FormulaEditor) currentEditor).getFormula();
}
return columnIndex;
}

4
designer_base/src/com/fr/design/editor/editor/FormulaEditor.java

@ -96,6 +96,10 @@ public class FormulaEditor extends Editor<Formula> {
}).setVisible(true);
}
public Formula getFormula(){
return formula;
}
/**
* Return the value of the CellEditor.
*/

2
designer_base/src/com/fr/design/file/MutilTempalteTabPane.java

@ -373,7 +373,7 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M
private void paintDefaultBackground(Graphics2D g2d) {
//画默认背景
g2d.setPaint(new GradientPaint(1, 1, new Color(217, 218, 221), 1, getHeight() - 1, new Color(217, 218, 221)));
g2d.fillRect(getX(), getY(), getWidth(), getHeight());
g2d.fillRect(0, 0, getWidth(), getHeight());
}

3
designer_base/src/com/fr/design/file/NewTemplatePane.java

@ -10,6 +10,7 @@ import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.geom.Line2D;
import java.awt.geom.Rectangle2D;
/**
* Author : daisy
@ -45,6 +46,8 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene
public void paintComponent(Graphics g) {
super.paintComponent(g);
g2d = (Graphics2D) g;
g2d.setColor(UIConstants.COMBOBOX_BTN_NORMAL);
g2d.fill(new Rectangle2D.Double(0, 0, getWidth(),getHeight()));
int sheetIconY = (getHeight() - newWorkBookIconMode.getIconHeight()) / 2;
newWorkBookIconMode.paintIcon(this, g2d, newIconStartX, sheetIconY);
// paintUnderLine(g2d);

29
designer_base/src/com/fr/design/file/TemplateTreePane.java

@ -5,8 +5,8 @@ package com.fr.design.file;
import com.fr.base.FRContext;
import com.fr.dav.LocalEnv;
import com.fr.design.gui.itree.filetree.TemplateFileTree;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itree.filetree.TemplateFileTree;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
@ -17,16 +17,18 @@ import com.fr.file.filetree.IOFileNodeFilter;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.stable.ProductConstants;
import com.fr.stable.CoreConstants;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.project.ProjectConstants;
import com.sun.jna.platform.FileUtils;
import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import java.awt.*;
import java.awt.event.*;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.logging.Level;
@ -177,7 +179,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
}
if (nodeFile.exists()) {
String path = StableUtils.pathJoin(new String[]{nodeFile.getEnvPath(), nodeFile.getPath()});
FRContext.getCurrentEnv().deleteFile(nodeFile.getPath());
moveToTrash(nodeFile);
deleteHistory(path.replaceAll("/", "\\\\"));
} else {
JOptionPane.showMessageDialog(this, Inter.getLocText("Warning-Template_Do_Not_Exsit"), ProductConstants.PRODUCT_NAME,
@ -187,7 +189,6 @@ public class TemplateTreePane extends JPanel implements FileOperations {
reportletsTree.refresh();
}
private void deleteHistory(String fileName) {
int index = HistoryTemplateListPane.getInstance().contains(fileName);
int size = HistoryTemplateListPane.getInstance().getHistoryCount();
@ -304,4 +305,24 @@ public class TemplateTreePane extends JPanel implements FileOperations {
}
}
/**
* 文件回收
*
* @param nodeFile 节点文件
*/
private void moveToTrash(FileNodeFILE nodeFile) {
FileUtils fileUtils = FileUtils.getInstance();
if (fileUtils.hasTrash()) {
try {
fileUtils.moveToTrash(new File[]{new File(StableUtils.pathJoin(nodeFile.getEnvPath(), nodeFile.getPath()))});
} catch (IOException e) {
FRLogger.getLogger().info(e.getMessage());
FRContext.getCurrentEnv().deleteFile(nodeFile.getPath());
}
} else {
FRLogger.getLogger().info("No Trash Available");
FRContext.getCurrentEnv().deleteFile(nodeFile.getPath());
}
}
}

2
designer_base/src/com/fr/design/formula/FormulaPane.java

@ -703,7 +703,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
UIScrollPane desScrollPane = new UIScrollPane(descriptionTextArea);
desScrollPane.setBorder(null);
this.add(this.createNamePane(Inter.getLocText("FR-Designer_FormulaPane_Formula_Description") + ":", desScrollPane), BorderLayout.EAST);
descriptionTextArea.setBackground(new Color(255, 255, 225));
descriptionTextArea.setBackground(Color.white);
descriptionTextArea.setLineWrap(true);
descriptionTextArea.setWrapStyleWord(true);
descriptionTextArea.setEditable(false);

59
designer_base/src/com/fr/design/gui/HyperlinkFilterHelper.java

@ -0,0 +1,59 @@
package com.fr.design.gui;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.BaseJForm;
import com.fr.design.mainframe.JTemplate;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
/**
* Created by mengao on 2017/9/22.
* 单元格超链图表超链在不同类型模版中下拉选项不同
*/
public class HyperlinkFilterHelper {
public static boolean whetherAddHyperlink4cell(String itemName) {
JTemplate jTemplate = getCurrentEditingTemplate();
if (jTemplate == null) {
return false;
}
//先屏蔽掉这个,之后还有别的
String[] names = {Inter.getLocText("FR-Hyperlink_Chart_Float")};
for (String name : names) {
if (!jTemplate.isJWorkBook() && ComparatorUtils.equals(itemName, name)) {
return false;
}
}
return whetherAddFormLink(jTemplate, itemName);
}
public static boolean whetherAddHyperlink4Chart(String itemName) {
JTemplate jTemplate = getCurrentEditingTemplate();
if (jTemplate == null) {
return false;
}
//先屏蔽掉这个,之后还有别的
String[] names = {Inter.getLocText("FR-Hyperlink_Chart_Float"), Inter.getLocText("FR-Hyperlink_Chart_Cell")};
for (String name : names) {
if (!jTemplate.isJWorkBook() && ComparatorUtils.equals(itemName, name)) {
if (jTemplate.getEditingReportIndex() == BaseJForm.ELEMENTCASE_TAB && ComparatorUtils.equals(itemName, names[0])) {
//表单报表块中图表悬浮元素超链,只屏蔽联动悬浮元素
return false;
} else if (jTemplate.getEditingReportIndex() == BaseJForm.FORM_TAB) {
//表单图表超链屏蔽掉联动悬浮元素和联动单元格
return false;
}
}
}
return whetherAddFormLink(jTemplate, itemName);
}
private static JTemplate getCurrentEditingTemplate() {
return HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
}
private static boolean whetherAddFormLink(JTemplate jTemplate, String itemName) {
String formName = Inter.getLocText("Hyperlink-Form_link");
return !(jTemplate.isJWorkBook() && ComparatorUtils.equals(itemName, formName));
}
}

23
designer_base/src/com/fr/design/gui/controlpane/JListControlPane.java

@ -8,13 +8,12 @@ import com.fr.design.data.tabledata.tabledatapane.GlobalMultiTDTableDataPane;
import com.fr.design.data.tabledata.tabledatapane.GlobalTreeTableDataPane;
import com.fr.design.data.tabledata.tabledatapane.MultiTDTableDataPane;
import com.fr.design.data.tabledata.tabledatapane.TreeTableDataPane;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.HyperlinkFilterHelper;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilist.JNameEdList;
import com.fr.design.gui.ilist.ListModelElement;
import com.fr.design.gui.ilist.ModNameActionListener;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.LineSeparator;
import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ShortCut;
@ -384,7 +383,7 @@ public abstract class JListControlPane extends JControlPane {
private void wrapActionListener(NameableCreator[] creators) {
for (final NameableCreator creator : creators) {
if (!whetherAdd(creator.menuName())) {
if (!HyperlinkFilterHelper.whetherAddHyperlink4cell(creator.menuName())) {
continue;
}
boolean isTrue = ComparatorUtils.equals(creator.menuName(), Inter.getLocText("Datasource-Stored_Procedure")) ||
@ -414,22 +413,6 @@ public abstract class JListControlPane extends JControlPane {
});
}
}
private boolean whetherAdd(String itemName) {
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (jTemplate == null) {
return false;
}
//先屏蔽掉这个,之后还有别的
String[] names = {Inter.getLocText("FR-Hyperlink_Chart_Float")};
for (String name : names) {
if (!jTemplate.isJWorkBook() && ComparatorUtils.equals(itemName, name)) {
return false;
}
}
String formName = Inter.getLocText("Hyperlink-Form_link");
return !(jTemplate.isJWorkBook() && ComparatorUtils.equals(itemName, formName));
}
}
/*
@ -468,7 +451,7 @@ public abstract class JListControlPane extends JControlPane {
this.setName(Inter.getLocText("FR-Action_Copy"));
this.setMnemonic('C');
this.setSmallIcon(BaseUtils
.readIcon("/com/fr/base/images/cell/control/copy.png"));
.readIcon("/com/fr/design/images/m_edit/copy.png"));
}
@Override

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

@ -178,7 +178,8 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
// 封装一层,加边框
JPanel toolBarPane = new JPanel(new BorderLayout());
toolBarPane.add(toolBar, BorderLayout.CENTER);
toolBarPane.setBorder(BorderFactory.createMatteBorder(1, 1, 0, 1, new Color(201, 198, 184)));
toolBarPane.setBorder(BorderFactory.createMatteBorder(1, 1, 0, 1, UIConstants.RULER_LINE_COLOR));
leftContentPane.add(toolBarPane, BorderLayout.NORTH);
// 顶部标签及add按钮
@ -193,6 +194,16 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
topToolBar.setLayout(new BorderLayout());
ShortCut addItem = addItemShortCut().getShortCut();
addItem.intoJToolBar(topToolBar);
JPanel leftTopPane = getLeftTopPane(topToolBar);
leftTopPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 6, 0));
leftPane.add(leftTopPane, BorderLayout.NORTH);
return leftPane;
}
protected JPanel getLeftTopPane (UIToolbar topToolBar) {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = { p, f};
@ -200,11 +211,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
Component[][] components = new Component[][]{
new Component[]{new UILabel(getAddItemText()), topToolBar},
};
JPanel leftTopPane = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize);
leftTopPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 6, 0));
leftPane.add(leftTopPane, BorderLayout.NORTH);
return leftPane;
return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize);
}
/**

29
designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java

@ -11,7 +11,7 @@ import com.fr.design.data.tabledata.tabledatapane.GlobalMultiTDTableDataPane;
import com.fr.design.data.tabledata.tabledatapane.GlobalTreeTableDataPane;
import com.fr.design.data.tabledata.tabledatapane.MultiTDTableDataPane;
import com.fr.design.data.tabledata.tabledatapane.TreeTableDataPane;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.HyperlinkFilterHelper;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilist.ListModelElement;
@ -19,7 +19,6 @@ import com.fr.design.gui.ilist.ModNameActionListener;
import com.fr.design.gui.ilist.UINameEdList;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.LineSeparator;
import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ShortCut;
@ -162,11 +161,15 @@ public abstract class UIListControlPane extends UIControlPane {
if (creators.length == 1) {
addItemShortCut = new AddItemUpdateAction(creators);
} else {
addItemShortCut = new AddItemMenuDef(creators);
addItemShortCut = getAddItemMenuDef(creators);
}
return new AbsoluteEnableShortCut(addItemShortCut);
}
protected AddItemMenuDef getAddItemMenuDef (NameableCreator[] creators) {
return new AddItemMenuDef(creators);
}
@Override
protected ShortCut4JControlPane removeItemShortCut() {
return new NormalEnableShortCut(new RemoveItemAction());
@ -211,6 +214,7 @@ public abstract class UIListControlPane extends UIControlPane {
@Override
public void populate(Nameable[] nameableArray) {
isPopulating = true; // 加一个标识位,避免切换单元格时,触发 saveSettings
nameableList.getCellEditor().stopCellEditing();
DefaultListModel listModel = (DefaultListModel) this.nameableList.getModel();
listModel.removeAllElements();
if (ArrayUtils.isEmpty(nameableArray)) {
@ -557,20 +561,8 @@ public abstract class UIListControlPane extends UIControlPane {
}
}
private boolean whetherAdd(String itemName) {
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (jTemplate == null) {
return false;
}
//先屏蔽掉这个,之后还有别的
String[] names = {Inter.getLocText("FR-Hyperlink_Chart_Float")};
for (String name : names) {
if (!jTemplate.isJWorkBook() && ComparatorUtils.equals(itemName, name)) {
return false;
}
}
String formName = Inter.getLocText("Hyperlink-Form_link");
return !(jTemplate.isJWorkBook() && ComparatorUtils.equals(itemName, formName));
protected boolean whetherAdd(String itemName){
return HyperlinkFilterHelper.whetherAddHyperlink4cell(itemName);
}
}
@ -591,6 +583,7 @@ public abstract class UIListControlPane extends UIControlPane {
UIListControlPane.this.nameableList.getCellEditor()
.stopCellEditing();
} catch (Exception ignored) {
// do nothing
}
// bug:在选中一个NameObject并删除,会遗留下Name.
doBeforeRemove();
@ -610,7 +603,7 @@ public abstract class UIListControlPane extends UIControlPane {
this.setName(Inter.getLocText("FR-Action_Copy"));
this.setMnemonic('C');
this.setSmallIcon(BaseUtils
.readIcon("/com/fr/base/images/cell/control/copy.png"));
.readIcon("/com/fr/design/images/m_edit/copy.png"));
}
@Override

17
designer_base/src/com/fr/design/gui/controlpane/UINameableListCellRenderer.java

@ -51,7 +51,7 @@ public class UINameableListCellRenderer extends
}
};
editButton.setIcon(listControlPane.isNewStyle() ? UIConstants.LIST_EDIT_ICON : UIConstants.CPT_ICON);
editButton.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, BORDER_COLOR));
editButton.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, UIConstants.LIST_ITEM_SPLIT_LINE));
editButton.setHorizontalAlignment(SwingConstants.CENTER);
label = new UILabel();
label.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
@ -62,7 +62,7 @@ public class UINameableListCellRenderer extends
}
private Border getNoFocusBorder() {
return BorderFactory.createMatteBorder(0, 0, 1, 0, BORDER_COLOR);
return BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.LIST_ITEM_SPLIT_LINE);
}
private void setText(String t) {
@ -110,19 +110,6 @@ public class UINameableListCellRenderer extends
setEnabled(list.isEnabled());
setFont(list.getFont());
Border border = null;
if (cellHasFocus) {
if (isSelected) {
border = DefaultLookup.getBorder(this, ui, "List.focusSelectedCellHighlightBorder");
}
if (border == null) {
border = DefaultLookup.getBorder(this, ui, "List.focusCellHighlightBorder");
}
} else {
border = getNoFocusBorder();
}
setBorder(border);
if (value instanceof ListModelElement) {
Nameable wrappee = ((ListModelElement) value).wrapper;
this.setText(((ListModelElement) value).wrapper.getName());

30
designer_base/src/com/fr/design/gui/core/WidgetOption.java

@ -127,27 +127,27 @@ public abstract class WidgetOption implements Serializable {
}
public static final WidgetOption DATEEDITOR = WidgetOptionFactory.createByWidgetClass(Inter.getLocText(new String[]{"Date", "Widget"}),
BaseUtils.readIcon("/com/fr/web/images/form/resources/date_16.png"),
BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/date_16.png"),
DateEditor.class);
public static final WidgetOption TREE = WidgetOptionFactory.createByWidgetClass(Inter.getLocText("Form-View_Tree"),
BaseUtils.readIcon("/com/fr/web/images/form/resources/tree_16.png"), TreeEditor.class);
BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/tree_16.png"), TreeEditor.class);
public static final WidgetOption TREECOMBOBOX = WidgetOptionFactory.createByWidgetClass(Inter.getLocText("FR-Designer_Tree-ComboBox"), BaseUtils.readIcon("/com/fr/web/images/form/resources/comboboxtree.png"),
public static final WidgetOption TREECOMBOBOX = WidgetOptionFactory.createByWidgetClass(Inter.getLocText("FR-Designer_Tree-ComboBox"), BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/comboboxtree.png"),
TreeComboBoxEditor.class);
public static final WidgetOption CHECKBOXGROUP = WidgetOptionFactory.createByWidgetClass(
Inter.getLocText(new String[]{"Form-CheckBoxGroup", "Widget"}), BaseUtils.readIcon("/com/fr/web/images/form/resources/checkbox_group_16.png"), CheckBoxGroup.class);
Inter.getLocText(new String[]{"Form-CheckBoxGroup", "Widget"}), BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/checkbox_group_16.png"), CheckBoxGroup.class);
public static final WidgetOption RADIOGROUP = WidgetOptionFactory.createByWidgetClass(
Inter.getLocText(new String[]{"Form-RadioGroup", "Widget"}), BaseUtils.readIcon("/com/fr/web/images/form/resources/button_group_16.png"),
Inter.getLocText(new String[]{"Form-RadioGroup", "Widget"}), BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/button_group_16.png"),
RadioGroup.class);
public static final WidgetOption NUMBEREDITOR = WidgetOptionFactory.createByWidgetClass(
Inter.getLocText(new String[]{"Number", "Widget"}), BaseUtils.readIcon("/com/fr/web/images/form/resources/number_field_16.png"), NumberEditor.class);
Inter.getLocText(new String[]{"Number", "Widget"}), BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/number_field_16.png"), NumberEditor.class);
public static final WidgetOption LABEL = WidgetOptionFactory.createByWidgetClass(
Inter.getLocText(new String[]{"Label", "Widget"}), BaseUtils.readIcon("/com/fr/web/images/form/resources/label_16.png"),
Inter.getLocText(new String[]{"Label", "Widget"}), BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/label_16.png"),
Label.class);
public static final WidgetOption BUTTON = WidgetOptionFactory.createByWidgetClass(
@ -155,23 +155,23 @@ public abstract class WidgetOption implements Serializable {
Button.class);
public static final WidgetOption FREEBUTTON = WidgetOptionFactory.createByWidgetClass(
Inter.getLocText(new String[]{"Form-Button", "Widget"}), BaseUtils.readIcon("/com/fr/web/images/form/resources/button_16.png"),
Inter.getLocText(new String[]{"Form-Button", "Widget"}), BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/button_16.png"),
FreeButton.class);
public static final WidgetOption MULTI_FILEEDITOR = WidgetOptionFactory.createByWidgetClass(
Inter.getLocText(new String[]{"File", "Widget"}), BaseUtils.readIcon("/com/fr/web/images/form/resources/files_up.png"),
Inter.getLocText(new String[]{"File", "Widget"}), BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/files_up.png"),
MultiFileEditor.class);
public static final WidgetOption COMBOBOX = WidgetOptionFactory.createByWidgetClass(
Inter.getLocText(new String[]{"Form-ComboBox", "Widget"}), BaseUtils.readIcon("/com/fr/web/images/form/resources/combo_box_16.png"),
Inter.getLocText(new String[]{"Form-ComboBox", "Widget"}), BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/combo_box_16.png"),
ComboBox.class);
public static final WidgetOption COMBOCHECKBOX = WidgetOptionFactory.createByWidgetClass(
Inter.getLocText(new String[]{"Form-ComboCheckBox", "Widget"}), BaseUtils.readIcon("/com/fr/web/images/form/resources/combo_check_16.png"),
Inter.getLocText(new String[]{"Form-ComboCheckBox", "Widget"}), BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/combo_check_16.png"),
ComboCheckBox.class);
public static final WidgetOption CHECKBOX = WidgetOptionFactory.createByWidgetClass(
Inter.getLocText(new String[]{"Form-CheckBox", "Widget"}), BaseUtils.readIcon("/com/fr/web/images/form/resources/check_box_16.png"),
Inter.getLocText(new String[]{"Form-CheckBox", "Widget"}), BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/check_box_16.png"),
CheckBox.class);
public static final WidgetOption LIST = WidgetOptionFactory.createByWidgetClass(
@ -183,16 +183,16 @@ public abstract class WidgetOption implements Serializable {
TableTree.class);
public static final WidgetOption TEXTEDITOR = WidgetOptionFactory.createByWidgetClass(Inter.getLocText(new String[]{"Text", "Widget"})
, BaseUtils.readIcon("/com/fr/web/images/form/resources/text_field_16.png"),
, BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/text_field_16.png"),
TextEditor.class);
public static final WidgetOption TEXTAREA = WidgetOptionFactory.createByWidgetClass(
Inter.getLocText(new String[]{"Form-TextArea", "Widget"}), BaseUtils.readIcon("/com/fr/web/images/form/resources/text_area_16.png"),
Inter.getLocText(new String[]{"Form-TextArea", "Widget"}), BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/text_area_16.png"),
TextArea.class);
public static final WidgetOption PASSWORD = WidgetOptionFactory.createByWidgetClass(
Inter.getLocText(new String[]{"Form-Password", "Widget"}),
BaseUtils.readIcon("/com/fr/web/images/form/resources/password_field_16.png"), Password.class);
BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/password_field_16.png"), Password.class);
public static final WidgetOption IFRAMEDITOR = WidgetOptionFactory.createByWidgetClass(Inter.getLocText("FR-Designer_Form-Iframe"), BaseUtils.readIcon("/com/fr/web/images/form/resources/iframe_16.png"),
IframeEditor.class);

29
designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java

@ -3,16 +3,19 @@ package com.fr.design.gui.frpane;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.designer.TargetComponent;
import com.fr.design.fun.HyperlinkProvider;
import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.UIListControlPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.module.DesignModuleFactory;
import com.fr.general.GeneralContext;
import com.fr.general.Inter;
import com.fr.general.NameObject;
import com.fr.js.JavaScript;
import com.fr.js.NameJavaScript;
import com.fr.js.NameJavaScriptGroup;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.stable.ListMap;
import com.fr.stable.Nameable;
@ -33,6 +36,28 @@ public abstract class HyperlinkGroupPane extends UIListControlPane {
super();
this.hyperlinkGroupPaneActionProvider = hyperlinkGroupPaneActionProvider;
}
@Override
protected void initComponentPane() {
super.initComponentPane();
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
refreshNameableCreator(createNameableCreators());
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(HyperlinkProvider.XML_TAG);
}
});
}
/**
* 生成添加按钮的NameableCreator
*

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

@ -75,7 +75,8 @@ public class RegPane extends BasicPane {
regComboBox = new UIComboBox(regType);
regComboBox.setRenderer(listCellRender);
JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Input_Rule")), regComboBox}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Input_Rule")), regComboBox}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
jPanel.add(contentPane, BorderLayout.NORTH);

61
designer_base/src/com/fr/design/gui/frpane/UICorrelationComboBoxPane.java

@ -1,28 +1,14 @@
package com.fr.design.gui.frpane;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.LayoutManager;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.SwingUtilities;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.fr.base.BaseUtils;
import com.fr.design.constants.UIConstants;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.DialogActionListener;
import com.fr.design.dialog.UIDialog;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.HyperlinkFilterHelper;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenutable.UIMenuNameableCreator;
@ -30,11 +16,7 @@ import com.fr.design.gui.imenutable.UIMenuTable;
import com.fr.design.hyperlink.ReportletHyperlinkPane;
import com.fr.design.hyperlink.WebHyperlinkPane;
import com.fr.design.javascript.EmailPane;
import com.fr.design.mainframe.BaseJForm;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.DialogActionListener;
import com.fr.design.dialog.UIDialog;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.js.AbstractJavaScript;
@ -43,7 +25,15 @@ import com.fr.js.ReportletHyperlink;
import com.fr.js.WebHyperlink;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
private static final Dimension DIALOG_SIZE = new Dimension(500, 500);
@ -98,7 +88,7 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
if (values.size() > 1) {
for (UIMenuNameableCreator value : values) {
final String itemName = value.getName();
if(!whetherAdd(itemName)){
if(!HyperlinkFilterHelper.whetherAddHyperlink4Chart(itemName)){
continue;
}
UIMenuItem item = new UIMenuItem(itemName);
@ -135,25 +125,6 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
initAddButtonListener();
}
private boolean whetherAdd(String itemName){
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
//先屏蔽掉这个,之后还有别的
String[] names = {Inter.getLocText("FR-Hyperlink_Chart_Float"), Inter.getLocText("FR-Hyperlink_Chart_Cell")};
for (String name : names){
if(!jTemplate.isJWorkBook() && ComparatorUtils.equals(itemName,name)){
if(jTemplate.getEditingReportIndex() == BaseJForm.ELEMENTCASE_TAB && ComparatorUtils.equals(itemName, names[0])){
//表单报表块中图表悬浮元素超链,只屏蔽联动悬浮元素
return false;
} else if(jTemplate.getEditingReportIndex() == BaseJForm.FORM_TAB) {
//表单图表超链屏蔽掉联动悬浮元素和联动单元格
return false;
}
}
}
String formName = Inter.getLocText("Hyperlink-Form_link");
return !(jTemplate.isJWorkBook() && ComparatorUtils.equals(itemName, formName));
}
private String createUnrepeatedName(String prefix) {
List<UIMenuNameableCreator> all = tablePane.updateBean();
// richer:生成的名字从1开始. kunsnat: 添加属性从0开始.

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

@ -36,7 +36,7 @@ public class UIButton extends JButton implements UIObserver {
private CellBorderStyle border = null;
protected UIObserverListener uiObserverListener;
private static final int TOOLTIP_INIT_DELAY = 1000; // 延迟 1s 显示提示文字
private static final int TOOLTIP_INIT_DELAY = 300; // 延迟 0.3s 显示提示文字
public UIButton() {
this(StringUtils.EMPTY);

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

@ -8,11 +8,14 @@ import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
import sun.swing.SwingUtilities2;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.plaf.basic.BasicHTML;
import javax.swing.text.View;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
@ -41,6 +44,10 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
this(iconArray, null);
}
public UIButtonGroup(Icon[][] iconArray) {
this(iconArray, null);
}
public UIButtonGroup(Icon[] iconArray, T[] objects) {
if (!ArrayUtils.isEmpty(objects) && iconArray.length == objects.length) {
this.objectList = Arrays.asList(objects);
@ -77,6 +84,42 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
}
}
public UIButtonGroup(Icon[][] iconArray, T[] objects) {
if (!ArrayUtils.isEmpty(objects) && iconArray.length == objects.length) {
this.objectList = Arrays.asList(objects);
}
labelButtonList = new ArrayList<UIToggleButton>(iconArray.length);
this.setLayout(getGridLayout(iconArray.length));
this.setBorder(getGroupBorder());
for (int i = 0; i < iconArray.length; i++) {
final int index = i;
Icon[] icon = iconArray[i];
final UIToggleButton labelButton = new UIToggleButton(icon) {
@Override
protected MouseListener getMouseListener() {
return new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
isClick = true;
if (!isEnabled()) {
return;
}
if (globalNameListener != null) {
globalNameListener.setGlobalName(buttonGroupName);
}
setSelectedWithFireChanged(index);
}
};
}
public boolean shouldResponseNameListener() {
return false;
}
};
initButton(labelButton);
}
}
public boolean hasClick() {
return isClick;
}
@ -145,6 +188,24 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
}
};
labelButton.setUI(new UIButtonUI() {
protected void paintText(Graphics g, AbstractButton b, String text, Rectangle textRec) {
View v = (View) b.getClientProperty(BasicHTML.propertyKey);
if (v != null) {
v.paint(g, textRec);
return;
}
FontMetrics fm = SwingUtilities2.getFontMetrics(b, g);
int mnemonicIndex = b.getDisplayedMnemonicIndex();
if (isPressed(b)) {
g.setColor(Color.white);
} else {
g.setColor(Color.black);
}
SwingUtilities2.drawStringUnderlineCharAt(b, g, text, mnemonicIndex, textRec.x + getTextShiftOffset(), textRec.y + fm.getAscent() + getTextShiftOffset());
}
});
initButton(labelButton);
}
}

6
designer_base/src/com/fr/design/gui/ibutton/UIButtonUI.java

@ -68,6 +68,10 @@ public class UIButtonUI extends BasicButtonUI {
}
private void paintText(Graphics g, AbstractButton b, String text) {
paintText(g, b, text ,textRec);
}
protected void paintText(Graphics g, AbstractButton b, String text, Rectangle textRec) {
View v = (View) b.getClientProperty(BasicHTML.propertyKey);
if (v != null) {
v.paint(g, textRec);
@ -156,7 +160,7 @@ public class UIButtonUI extends BasicButtonUI {
paintModelIcon(model, icon, g, c);
}
private void paintModelIcon(ButtonModel model, Icon icon, Graphics g, JComponent c) {
protected void paintModelIcon(ButtonModel model, Icon icon, Graphics g, JComponent c) {
if (model.isPressed() && model.isArmed()) {
icon.paintIcon(c, g, iconRec.x + getTextShiftOffset(),
iconRec.y + getTextShiftOffset());

4
designer_base/src/com/fr/design/gui/ibutton/UIHeadGroup.java

@ -23,8 +23,8 @@ public class UIHeadGroup extends JPanel {
public UIHeadGroup(String[] textArray) {
labelButtonList = new ArrayList<UIToggleButton>(textArray.length);
this.setBackground(UIConstants.NORMAL_BACKGROUND);
this.setLayout(new GridLayout(0, textArray.length, 1, 0));
this.setBackground(UIConstants.TREE_BACKGROUND);
this.setLayout(new GridLayout(0, textArray.length, 0, 0));
// this.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
for (int i = 0; i < textArray.length; i++) {
final int index = i;

24
designer_base/src/com/fr/design/gui/ibutton/UIToggleButton.java

@ -3,12 +3,13 @@ package com.fr.design.gui.ibutton;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Shape;
import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.geom.RoundRectangle2D;
import javax.swing.Icon;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
@ -46,6 +47,26 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
addMouseListener(getMouseListener());
}
/**
* 需要反白的按钮接口
* support icons[normalIcon, selectedIcon]
* @param icons
*/
public UIToggleButton(Icon[] icons) {
super(icons[0], null, icons[1]);
setSelectedIcon(icons[1]);
setExtraPainted(true);
addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
if (!UIToggleButton.super.isSelected()) {
UIToggleButton.super.setSelected(!UIToggleButton.super.isSelected());
}
}
});
addMouseListener(getMouseListener());
}
public void setGlobalName(String name){
toggleButtonName = name ;
}
@ -66,6 +87,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
@Override
public void setSelected(boolean isSelected) {
super.setSelected(isSelected);
if (this.isSelected != isSelected) {
this.isSelected = isSelected;
repaint();

2
designer_base/src/com/fr/design/gui/icombobox/LazyComboBox.java

@ -175,8 +175,10 @@ public abstract class LazyComboBox extends UIComboBox implements PopupMenuListen
this.item = item;
this.setting = true;
textField.setSetting(true);
String newText = (item == null) ? "" : item.toString();
textField.setText(newText);
textField.setSetting(false);
this.setting = false;
}

13
designer_base/src/com/fr/design/gui/icombobox/UIComboBoxRenderer.java

@ -26,9 +26,16 @@ public class UIComboBoxRenderer extends DefaultListCellRenderer {
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
cellHasFocus = cellHasFocus && !this.isEnabled();
JLabel renderer =(JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
renderer.setForeground(Color.black);
list.setSelectionBackground(UIConstants.COMBOBOX_BTN_PRESS);
list.setSelectionForeground(Color.black);
renderer.setOpaque(true);
list.setSelectionBackground(UIConstants.NORMAL_BLUE);
list.setSelectionForeground(Color.WHITE);
if (isSelected) {
renderer.setForeground(list.getSelectionForeground());
renderer.setBackground(list.getSelectionBackground());
} else {
renderer.setForeground(list.getForeground());
renderer.setBackground(list.getBackground());
}
renderer.setText(" " + renderer.getText());
return renderer;
}

42
designer_base/src/com/fr/design/gui/ispinner/UISpinner.java

@ -6,8 +6,9 @@ import com.fr.design.event.GlobalNameObserver;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIButtonUI;
import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
@ -16,6 +17,7 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.plaf.ButtonUI;
import java.awt.*;
import java.awt.event.*;
@ -164,6 +166,34 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
}
}
private class ButtionUI extends UIButtonUI {
private boolean isNormalPaint = true;
@Override
protected void doExtraPainting(UIButton b, Graphics2D g2d, int w, int h, String selectedRoles) {
if (isPressed(b) && b.isPressedPainted()) {
isNormalPaint = false;
Color pressColor = UIConstants.COMBOBOX_BTN_PRESS;
GUIPaintUtils.fillPressed(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), pressColor);
} else if (isRollOver(b)) {
isNormalPaint = false;
Color hoverColor = UIConstants.COMBOBOX_BTN_ROLLOVER;
GUIPaintUtils.fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), hoverColor);
} else if (b.isNormalPainted()) {
isNormalPaint = true;
GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted());
}
}
@Override
protected void paintModelIcon(ButtonModel model, Icon icon, Graphics g, JComponent c) {
if (isNormalPaint) {
g.setColor(UIConstants.COMBOBOX_BTN_NORMAL);
g.fillRect(0, 0, c.getWidth(), c.getHeight());
}
super.paintModelIcon(model, icon, g, c);
}
}
private void initComponents() {
textField = initNumberField();
@ -174,12 +204,22 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
public boolean shouldResponseChangeListener() {
return false;
}
@Override
public ButtonUI getUI() {
return new ButtionUI();
}
};
preButton.setRoundBorder(true, Constants.LEFT);
nextButton = new UIButton(UIConstants.ARROW_DOWN_ICON) {
public boolean shouldResponseChangeListener() {
return false;
}
@Override
public ButtonUI getUI() {
return new ButtionUI();
}
};
nextButton.setRoundBorder(true, Constants.LEFT);
setLayout(new BorderLayout());

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

@ -26,6 +26,9 @@ public class UITextField extends JTextField implements UIObserver, GlobalNameObs
private GlobalNameListener globalNameListener = null;
private Dimension preferredSize = null;
//有些情况下setText的时候不希望触发attributeChange,添加一个属性标识
private boolean isSetting = false;
public UITextField() {
super();
InputEventBaseOnOS.addBasicEditInputMap(this);
@ -78,6 +81,13 @@ public class UITextField extends JTextField implements UIObserver, GlobalNameObs
}
}
public boolean isSetting() {
return isSetting;
}
public void setSetting(boolean setting) {
isSetting = setting;
}
public void setPreferredSize(Dimension preferredSize) {
this.preferredSize = preferredSize;
@ -88,6 +98,9 @@ public class UITextField extends JTextField implements UIObserver, GlobalNameObs
}
protected void attributeChange() {
if(isSetting){
return;
}
if (globalNameListener != null && shouldResponseNameListener()) {
globalNameListener.setGlobalName(textFeildName);
}

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

Loading…
Cancel
Save