Browse Source

Merge remote-tracking branch 'origin/release/9.0' into release/9.0

master
mengao 7 years ago
parent
commit
77cdcecaf9
  1. 207
      designer/src/com/fr/design/actions/cell/style/AlignmentAction.java
  2. 140
      designer/src/com/fr/design/actions/cell/style/ReportFontBoldAction.java
  3. 14
      designer/src/com/fr/design/actions/cell/style/ReportFontItalicAction.java
  4. 13
      designer/src/com/fr/design/actions/cell/style/ReportFontUnderlineAction.java
  5. 99
      designer/src/com/fr/design/mainframe/ElementCasePane.java
  6. 3
      designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java
  7. 24
      designer/src/com/fr/design/mainframe/ReportFloatPane.java
  8. 1
      designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java
  9. 13
      designer/src/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java
  10. 5
      designer/src/com/fr/design/mainframe/alphafine/cell/model/AlphaCellModel.java
  11. 3
      designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java
  12. 1
      designer/src/com/fr/design/mainframe/alphafine/cell/render/TitleCellRender.java
  13. 76
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  14. 7
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java
  15. 2
      designer/src/com/fr/design/mainframe/alphafine/preview/FilePreviewPane.java
  16. 2
      designer/src/com/fr/design/mainframe/alphafine/preview/NoResultPane.java
  17. 7
      designer/src/com/fr/design/mainframe/alphafine/search/manager/FileSearchManager.java
  18. 1
      designer/src/com/fr/design/mainframe/alphafine/search/manager/PluginSearchManager.java
  19. 29
      designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java
  20. 12
      designer/src/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java
  21. 2
      designer/src/com/fr/design/report/UnitFieldPane.java
  22. 12
      designer/src/com/fr/design/widget/ui/AbstractDataModify.java
  23. 18
      designer/src/com/fr/design/widget/ui/DateEditorDefinePane.java
  24. 16
      designer/src/com/fr/start/Designer.java
  25. 44
      designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java
  26. 55
      designer_base/src/com/fr/design/data/DesignTableDataManager.java
  27. 13
      designer_base/src/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java
  28. 5
      designer_base/src/com/fr/design/data/datapane/preview/PreviewTablePane.java
  29. 13
      designer_base/src/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java
  30. 2
      designer_base/src/com/fr/design/data/tabledata/wrapper/AbstractTableDataWrapper.java
  31. 10
      designer_base/src/com/fr/design/designer/TargetComponent.java
  32. 2
      designer_base/src/com/fr/design/gui/ibutton/UIButton.java
  33. 4
      designer_base/src/com/fr/design/gui/ibutton/UIHeadGroup.java
  34. 2
      designer_base/src/com/fr/design/gui/ibutton/UIToggleButton.java
  35. 13
      designer_base/src/com/fr/design/gui/icombobox/UIComboBoxRenderer.java
  36. 1
      designer_base/src/com/fr/design/gui/itree/checkboxtree/NullTristateCheckBox.java
  37. BIN
      designer_base/src/com/fr/design/images/buttonicon/leftNormal.png
  38. BIN
      designer_base/src/com/fr/design/images/m_format/cellstyle/bold_white.png
  39. BIN
      designer_base/src/com/fr/design/images/m_format/cellstyle/h_center_normal_white.png
  40. BIN
      designer_base/src/com/fr/design/images/m_format/cellstyle/h_left_normal_white.png
  41. BIN
      designer_base/src/com/fr/design/images/m_format/cellstyle/h_right_normal_white.png
  42. BIN
      designer_base/src/com/fr/design/images/m_format/cellstyle/italic_white.png
  43. BIN
      designer_base/src/com/fr/design/images/m_format/cellstyle/underline_white.png
  44. 1845
      designer_base/src/com/fr/design/mainframe/DesignerFrame.java
  45. 253
      designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  46. 12
      designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java
  47. 8
      designer_base/src/com/fr/design/mainframe/widget/BasicPropertyPane.java
  48. 41
      designer_base/src/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java
  49. 8
      designer_base/src/com/fr/design/widget/DataModify.java
  50. 105
      designer_base/src/com/fr/env/RemoteEnv.java
  51. 38
      designer_form/src/com/fr/design/mainframe/JForm.java
  52. 21
      designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleElementCaseToolBarEditor.java
  53. 22
      designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java
  54. 10
      designer_form/src/com/fr/design/widget/ui/designer/AbstractDataModify.java
  55. 31
      designer_form/src/com/fr/design/widget/ui/designer/DateEditorDefinePane.java
  56. 16
      designer_form/src/com/fr/design/widget/ui/designer/component/PaddingBoundPane.java
  57. 31
      designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java
  58. 115
      designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java
  59. 16
      designer_form/src/com/fr/design/widget/ui/designer/layout/ElementEditorDefinePane.java
  60. 46
      designer_form/src/com/fr/design/widget/ui/designer/layout/WTabFitLayoutDefinePane.java
  61. 19
      designer_form/src/com/fr/design/widget/ui/designer/layout/WTitleLayoutDefinePane.java

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;
}
}

14
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;

99
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;
}
@ -1149,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();
@ -1267,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)}
);
}

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

@ -176,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);
}
// 格式菜单

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() {

1
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;

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;
}

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

@ -27,7 +27,7 @@ public abstract class AlphaCellModel implements Comparable {
this.content = content;
}
public CellType getType() {
return type;
}
@ -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);

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;

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();

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.

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;
}
}

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

@ -36,7 +36,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() {
@ -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;

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

@ -135,26 +135,24 @@ public class Designer extends BaseDesigner {
public UILargeToolbar createLargeToolbar() {
UILargeToolbar largeToolbar = super.createLargeToolbar();
largeToolbar.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 4));
JPanel templeJpanel = new JPanel() {
largeToolbar.add(new JPanel() {
public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize();
dim.width = 1;
return dim;
}
};
templeJpanel.setBackground(Color.WHITE);
largeToolbar.add(templeJpanel);
});
createRunButton(largeToolbar);
largeToolbar.add(run);
templeJpanel = new JPanel() {
run.setBackground(UIConstants.TREE_BACKGROUND);
largeToolbar.add(new JPanel() {
public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize();
dim.width = GAP;
return dim;
}
};
templeJpanel.setBackground(Color.WHITE);
largeToolbar.add(templeJpanel);
});
largeToolbar.addSeparator(new Dimension(2, 42));
largeToolbar.setBorder(new MatteBorder(new Insets(0, 0, 1, 0), UIConstants.LINE_COLOR));
return largeToolbar;
}
@ -352,7 +350,7 @@ public class Designer extends BaseDesigner {
*
* @return 面板组件
*/
public Component createAlphafinePane() {
public Component createAlphaFinePane() {
return AlphaFinePane.getAlphaFinePane();
}

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;
}

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 {

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/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;
}

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);

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;

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

@ -122,7 +122,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
@Override
public void mouseClicked(MouseEvent e) {
if (isEnabled() && !isEventBannded) {
setSelectedWithFireListener(!isSelected());
setSelectedWithFireListener(!isSelected());
}
}
};

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;
}

1
designer_base/src/com/fr/design/gui/itree/checkboxtree/NullTristateCheckBox.java

@ -65,7 +65,6 @@ public class NullTristateCheckBox extends TristateCheckBox {
// @Override
public void updateUI() {
super.updateUI();
clearAttribute();
}

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 165 B

After

Width:  |  Height:  |  Size: 193 B

BIN
designer_base/src/com/fr/design/images/m_format/cellstyle/bold_white.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 B

BIN
designer_base/src/com/fr/design/images/m_format/cellstyle/h_center_normal_white.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 B

BIN
designer_base/src/com/fr/design/images/m_format/cellstyle/h_left_normal_white.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

BIN
designer_base/src/com/fr/design/images/m_format/cellstyle/h_right_normal_white.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

BIN
designer_base/src/com/fr/design/images/m_format/cellstyle/italic_white.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 B

BIN
designer_base/src/com/fr/design/images/m_format/cellstyle/underline_white.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 B

1845
designer_base/src/com/fr/design/mainframe/DesignerFrame.java

File diff suppressed because it is too large Load Diff

253
designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -5,17 +5,33 @@ package com.fr.design.mainframe.toolbar;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.base.FRCoreContext;
import com.fr.design.DesignState;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.community.*;
import com.fr.design.actions.file.*;
import com.fr.design.actions.community.BBSAction;
import com.fr.design.actions.community.BugAction;
import com.fr.design.actions.community.NeedAction;
import com.fr.design.actions.community.QuestionAction;
import com.fr.design.actions.community.SignAction;
import com.fr.design.actions.community.UpAction;
import com.fr.design.actions.community.VideoAction;
import com.fr.design.actions.file.CloseCurrentTemplateAction;
import com.fr.design.actions.file.ExitDesignerAction;
import com.fr.design.actions.file.OpenRecentReportMenuDef;
import com.fr.design.actions.file.OpenTemplateAction;
import com.fr.design.actions.file.PreferenceAction;
import com.fr.design.actions.file.SwitchExistEnv;
import com.fr.design.actions.help.AboutAction;
import com.fr.design.actions.help.TutorialAction;
import com.fr.design.actions.help.WebDemoAction;
import com.fr.design.actions.help.alphafine.AlphaFineAction;
import com.fr.design.actions.server.*;
import com.fr.design.actions.help.alphafine.AlphaFineConfigManager;
import com.fr.design.actions.server.ConnectionListAction;
import com.fr.design.actions.server.FunctionManagerAction;
import com.fr.design.actions.server.GlobalParameterAction;
import com.fr.design.actions.server.GlobalTableDataAction;
import com.fr.design.actions.server.PlatformManagerAction;
import com.fr.design.actions.server.PluginManagerAction;
import com.fr.design.file.NewTemplatePane;
import com.fr.design.fun.MenuHandler;
import com.fr.design.fun.TableDataPaneProcessor;
@ -35,7 +51,6 @@ import com.fr.env.RemoteEnv;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.general.Inter;
import com.fr.general.VT4FR;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginRuntime;
import com.fr.plugin.manage.PluginFilter;
@ -48,8 +63,11 @@ import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.Set;
/**
* @author richer
@ -61,12 +79,63 @@ import java.util.List;
* 还有docking的状态的保存,下次打开设计器,也应该是这样的
*/
public abstract class ToolBarMenuDock {
public static final int PANLE_HEIGNT = 26;
public static final ToolBarMenuDockPlus NULLAVOID = new ToolBarMenuDockPlus() {
@Override
public ToolBarDef[] toolbars4Target() {
return new ToolBarDef[0];
}
@Override
public ShortCut[] shortcut4FileMenu() {
return new ShortCut[0];
}
@Override
public MenuDef[] menus4Target() {
return new MenuDef[0];
}
@Override
public JPanel[] toolbarPanes4Form() {
return new JPanel[0];
}
public JComponent[] toolBarButton4Form() {
return new JComponent[0];
}
public JComponent toolBar4Authority() {
return new JPanel();
}
@Override
public int getMenuState() {
return DesignState.WORK_SHEET;
}
public int getToolBarHeight() {
return PANLE_HEIGNT;
}
/**
* 导出菜单的子菜单 目前用于图表设计器
*
* @return 子菜单
*/
public ShortCut[] shortcut4ExportMenu() {
return new ShortCut[0];
}
};
private static final String FINEREPORT = "FineReport";
private static final int MENUBAR_HEIGHT = 22;
public static final int PANLE_HEIGNT = 26;
private MenuDef[] menus;
private ToolBarDef toolBarDef;
private List<UpdateActionModel> shortCutsList;
/**
* 更新菜单
*/
@ -118,6 +187,10 @@ public abstract class ToolBarMenuDock {
return jMenuBar;
}
//////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////menu below/////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
/**
* 生成报表设计和表单设计的编辑区域
*
@ -127,10 +200,6 @@ public abstract class ToolBarMenuDock {
return null;
}
//////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////menu below/////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
public MenuDef[] menus(final ToolBarMenuDockPlus plus) {
java.util.List<MenuDef> menuList = new java.util.ArrayList<MenuDef>();
// 添加文件菜单
@ -164,6 +233,7 @@ public abstract class ToolBarMenuDock {
/**
* 获取所有actionmodel
*
* @param menuList
*/
private void addAllUpdateActionsToList(List<MenuDef> menuList) {
@ -175,6 +245,7 @@ public abstract class ToolBarMenuDock {
/**
* 递归获取所有UpdateAction
*
* @param menuDef
*/
private void addUpdateActionToList(MenuDef menuDef, int level) {
@ -195,11 +266,11 @@ public abstract class ToolBarMenuDock {
}
}
public void addCommunityMenuDef(java.util.List<MenuDef> menuList){
public void addCommunityMenuDef(java.util.List<MenuDef> menuList) {
Locale locale = FRContext.getLocale();
Locale [] locales =supportCommunityLocales();
for(int i = 0; i < locales.length; i++) {
if(locale.equals(locales[i])){
Locale[] locales = supportCommunityLocales();
for (int i = 0; i < locales.length; i++) {
if (locale.equals(locales[i])) {
menuList.add(createCommunityMenuDef());
break;
}
@ -218,13 +289,13 @@ public abstract class ToolBarMenuDock {
// 给菜单加插件入口
for (MenuDef m : menuDefs) {
switch (m.getAnchor()) {
case MenuHandler.TEMPLATE :
case MenuHandler.TEMPLATE:
insertMenu(m, MenuHandler.TEMPLATE, new TemplateTargetAction(plus));
break;
case MenuHandler.INSERT :
case MenuHandler.INSERT:
insertMenu(m, MenuHandler.INSERT);
break;
case MenuHandler.CELL :
case MenuHandler.CELL:
insertMenu(m, MenuHandler.CELL);
break;
default:
@ -271,7 +342,7 @@ public abstract class ToolBarMenuDock {
addSwitchExistEnvAction(menuDef);
menuDef.addShortCut( new ExitDesignerAction());
menuDef.addShortCut(new ExitDesignerAction());
insertMenu(menuDef, MenuHandler.FILE);
return menuDef;
@ -293,7 +364,7 @@ public abstract class ToolBarMenuDock {
menuDef.addShortCut(new SwitchExistEnv());
}
protected ShortCut openTemplateAction(){
protected ShortCut openTemplateAction() {
return new OpenTemplateAction();
}
@ -308,17 +379,15 @@ public abstract class ToolBarMenuDock {
* 创建论坛登录面板, chart那边不需要
*
* @return 面板组件
*
*/
public Component createBBSLoginPane(){
public Component createBBSLoginPane() {
return new UILabel();
}
public Component createAlphafinePane(){
public Component createAlphaFinePane() {
return new UILabel();
}
protected MenuDef createServerMenuDef(ToolBarMenuDockPlus plus) {
MenuDef menuDef = new MenuDef(Inter.getLocText("FR-Designer_M-Server"), 'S');
@ -361,6 +430,7 @@ public abstract class ToolBarMenuDock {
/**
* 创建帮助子菜单
*
* @return 帮组菜单的子菜单
*/
public ShortCut[] createHelpShortCuts() {
@ -372,25 +442,22 @@ public abstract class ToolBarMenuDock {
shortCuts.add(new TutorialAction());
}
shortCuts.add(SeparatorDef.DEFAULT);
//shortCuts.add(new TutorialAction());
shortCuts.add(SeparatorDef.DEFAULT);
if (ComparatorUtils.equals(ProductConstants.APP_NAME,FINEREPORT)) {
// mod by anchore 16/11/17 去掉反馈
//shortCuts.add(new FeedBackAction());
if (ComparatorUtils.equals(ProductConstants.APP_NAME, FINEREPORT)) {
shortCuts.add(SeparatorDef.DEFAULT);
}
if (AlphaFineConfigManager.isALPHALicAvailable()) {
shortCuts.add(new AlphaFineAction());
shortCuts.add(SeparatorDef.DEFAULT);
// shortCuts.add(new ForumAction());
}
shortCuts.add(SeparatorDef.DEFAULT);
shortCuts.add(new AlphaFineAction());
shortCuts.add(SeparatorDef.DEFAULT);
shortCuts.add(new AboutAction());
return shortCuts.toArray(new ShortCut[shortCuts.size()]);
}
/**
* 创建社区子菜单
*
* @return 社区菜单的子菜单
*/
public ShortCut[] createCommunityShortCuts() {
@ -405,6 +472,7 @@ public abstract class ToolBarMenuDock {
shortCuts.add(new SignAction());
return shortCuts.toArray(new ShortCut[shortCuts.size()]);
}
public MenuDef createHelpMenuDef() {
MenuDef menuDef = new MenuDef(Inter.getLocText("FR-Designer_Help"), 'H');
ShortCut[] otherHelpShortCuts = createHelpShortCuts();
@ -414,6 +482,7 @@ public abstract class ToolBarMenuDock {
insertMenu(menuDef, MenuHandler.HELP);
return menuDef;
}
public MenuDef createCommunityMenuDef() {
MenuDef menuDef = new MenuDef(Inter.getLocText("FR-Designer_COMMUNITY"), 'C');
ShortCut[] otherCommunityShortCuts = createCommunityShortCuts();
@ -423,6 +492,7 @@ public abstract class ToolBarMenuDock {
insertMenu(menuDef, MenuHandler.BBS);
return menuDef;
}
/**
* 生成工具栏
*
@ -460,7 +530,6 @@ public abstract class ToolBarMenuDock {
}
}
protected JPanel polyToolBar(String text) {
JPanel panel = new JPanel(new BorderLayout()) {
public Dimension getPreferredSize() {
@ -477,7 +546,6 @@ public abstract class ToolBarMenuDock {
return panel;
}
/**
* 重置上面的工具栏
*
@ -488,7 +556,6 @@ public abstract class ToolBarMenuDock {
return plus.toolBarButton4Form();
}
/**
* 创建大的工具按钮
*
@ -507,62 +574,11 @@ public abstract class ToolBarMenuDock {
return new UIButton[0];
}
protected void refreshLargeToolbarState() {
}
public static final ToolBarMenuDockPlus NULLAVOID = new ToolBarMenuDockPlus() {
@Override
public ToolBarDef[] toolbars4Target() {
return new ToolBarDef[0];
}
@Override
public ShortCut[] shortcut4FileMenu() {
return new ShortCut[0];
}
@Override
public MenuDef[] menus4Target() {
return new MenuDef[0];
}
@Override
public JPanel[] toolbarPanes4Form() {
return new JPanel[0];
}
public JComponent[] toolBarButton4Form() {
return new JComponent[0];
}
public JComponent toolBar4Authority() {
return new JPanel();
}
@Override
public int getMenuState() {
return DesignState.WORK_SHEET;
}
public int getToolBarHeight(){
return PANLE_HEIGNT;
}
/**
* 导出菜单的子菜单 目前用于图表设计器
*
* @return 子菜单
*/
public ShortCut[] shortcut4ExportMenu(){
return new ShortCut[0];
}
};
public NewTemplatePane getNewTemplatePane(){
public NewTemplatePane getNewTemplatePane() {
return new NewTemplatePane() {
@Override
public Icon getNew() {
@ -584,28 +600,28 @@ public abstract class ToolBarMenuDock {
protected void insertMenu(MenuDef menuDef, String anchor) {
insertMenu(menuDef, anchor, new NoTargetAction());
}
protected void insertMenu(MenuDef menuDef, String anchor, ShortCutMethodAction action) {
listenPluginMenuChange(menuDef, anchor, action);
Set<MenuHandler> set = ExtraDesignClassManager.getInstance().getArray(MenuHandler.MARK_STRING);
addExtraMenus(menuDef, anchor, action, set);
}
private void listenPluginMenuChange(final MenuDef menuDef, final String anchor, final ShortCutMethodAction action) {
PluginFilter filter = new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(MenuHandler.MARK_STRING);
}
};
GeneralContext.listenPlugin(PluginEventType.BeforeStop, new PluginEventListener() {
@Override
public void on(PluginEvent event) {
PluginRuntime runtime = event.getContext().getRuntime();
@ -614,59 +630,59 @@ public abstract class ToolBarMenuDock {
}
}, filter);
GeneralContext.listenPlugin(PluginEventType.AfterRun, new PluginEventListener() {
@Override
public void on(PluginEvent event) {
PluginRuntime runtime = event.getContext().getRuntime();
Set<MenuHandler> menuHandlers = runtime.get(MenuHandler.MARK_STRING);
addExtraMenus(menuDef, anchor, action, menuHandlers);
}
}, filter);
}
private void removeExtraMenus(MenuDef menuDef, String anchor, ShortCutMethodAction action, Set<MenuHandler> set) {
List<MenuHandler> target = new ArrayList<>();
for (MenuHandler handler : set) {
if (ComparatorUtils.equals(handler.category(), anchor)) {
target.add(handler);
}
}
for (MenuHandler handler : target) {
int insertPosition = handler.insertPosition(menuDef.getShortCutCount());
if (insertPosition == MenuHandler.HIDE) {
return;
}
ShortCut shortCut = action.methodAction(handler);
if (shortCut == null){
if (shortCut == null) {
continue;
}
menuDef.removeShortCut(shortCut);
}
}
private void addExtraMenus(MenuDef menuDef, String anchor, ShortCutMethodAction action, Set<MenuHandler> set) {
List<MenuHandler> target = new ArrayList<>();
for (MenuHandler handler : set) {
if (ComparatorUtils.equals(handler.category(), anchor)) {
target.add(handler);
}
}
for (MenuHandler handler : target) {
int insertPosition = handler.insertPosition(menuDef.getShortCutCount());
if (insertPosition == MenuHandler.HIDE) {
return;
}
ShortCut shortCut = action.methodAction(handler);
if (shortCut == null){
if (shortCut == null) {
continue;
}
if (insertPosition == MenuHandler.LAST) {
if (handler.insertSeparatorBefore()) {
menuDef.addShortCut(SeparatorDef.DEFAULT);
@ -676,48 +692,47 @@ public abstract class ToolBarMenuDock {
menuDef.insertShortCut(insertPosition, shortCut);
if (handler.insertSeparatorBefore()) {
menuDef.insertShortCut(insertPosition, SeparatorDef.DEFAULT);
insertPosition ++;
insertPosition++;
}
if (handler.insertSeparatorAfter()) {
insertPosition ++;
insertPosition++;
menuDef.insertShortCut(insertPosition, SeparatorDef.DEFAULT);
}
}
}
}
/**
* 设计器退出时, 做的一些操作.
*
*/
public void shutDown(){
public void shutDown() {
}
private interface ShortCutMethodAction{
private interface ShortCutMethodAction {
public ShortCut methodAction(MenuHandler handler);
}
private abstract class AbstractShortCutMethodAction implements ShortCutMethodAction{
private abstract class AbstractShortCutMethodAction implements ShortCutMethodAction {
public ShortCut methodAction(MenuHandler handler){
public ShortCut methodAction(MenuHandler handler) {
return handler.shortcut();
}
}
//不需要编辑对象的菜单, 比如文件, 服务器, 关于
private class NoTargetAction extends AbstractShortCutMethodAction{
private class NoTargetAction extends AbstractShortCutMethodAction {
}
//模板为对象的菜单, 比如模板, 后续如果单元格也要, 直接加个CellTargetAction即可.
//在methodAction中做handler.shortcut(cell), 不需要修改handler中原有接口, 加个shortcut(cell).
private class TemplateTargetAction extends AbstractShortCutMethodAction{
private class TemplateTargetAction extends AbstractShortCutMethodAction {
private ToolBarMenuDockPlus plus;
public TemplateTargetAction(ToolBarMenuDockPlus plus){
public TemplateTargetAction(ToolBarMenuDockPlus plus) {
this.plus = plus;
}

12
designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java

@ -1,5 +1,8 @@
package com.fr.design.mainframe.toolbar;
import com.fr.design.actions.UpdateAction;
import com.fr.general.ComparatorUtils;
import java.util.List;
/**
@ -23,4 +26,13 @@ public class UpdateActionManager {
public void setUpdateActions(List<UpdateActionModel> updateActions) {
this.updateActions = updateActions;
}
public boolean isEnable(UpdateAction updateAction) {
for (UpdateActionModel action : updateActions) {
if (ComparatorUtils.equals(updateAction.getName(), action.getActionName()) && action.getAction().isEnabled()) {
return true;
}
}
return false;
}
}

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

@ -8,8 +8,10 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
/**
* Created by plough on 2017/8/7.
@ -25,7 +27,7 @@ public class BasicPropertyPane extends BasicPane {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
widgetName = new UITextField();
widgetName.setGlobalName(Inter.getLocText("FR-Designer_Widget_Name"));
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p};

41
designer_base/src/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java

@ -1,27 +1,33 @@
package com.fr.design.mainframe.widget.accessibles;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import javax.swing.AbstractButton;
import javax.swing.BorderFactory;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIButton;
import javax.swing.JComponent;
import javax.swing.JOptionPane;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.plaf.ButtonUI;
import com.fr.base.BaseUtils;
import com.fr.design.Exception.ValidationException;
import com.fr.design.gui.ibutton.UIButtonUI;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.widget.editors.ITextComponent;
import com.fr.design.mainframe.widget.editors.TextField;
import com.fr.design.dialog.BasicPane;
import com.fr.design.designer.properties.Decoder;
import com.fr.design.designer.properties.Encoder;
import com.fr.design.utils.gui.GUIPaintUtils;
/**
* @since 6.5.3
@ -77,7 +83,28 @@ public class BaseAccessibleEditor extends BasicPane implements AccessibleEditor
setOpaque(false);
if (showButton) {
btPopup = new UIButton();
btPopup = new UIButton(){
@Override
public ButtonUI getUI() {
return new UIButtonUI() {
@Override
protected boolean isPressed(AbstractButton b) {
return model.isArmed() && model.isPressed();
}
@Override
protected void doExtraPainting(UIButton b, Graphics2D g2d, int w, int h, String selectedRoles) {
if (isPressed(b) && b.isPressedPainted()) {
GUIPaintUtils.fillPressed(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), UIConstants.COMBOBOX_BTN_PRESS);
} else if (isRollOver(b)) {
GUIPaintUtils.fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), UIConstants.COMBOBOX_BTN_ROLLOVER);
} else if (b.isNormalPainted()) {
GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), UIConstants.COMBOBOX_BTN_NORMAL);
}
}
};
}
};
initPopupButton();
btPopup.addActionListener(new ActionListener() {
@ -189,4 +216,6 @@ public class BaseAccessibleEditor extends BasicPane implements AccessibleEditor
public static void showMessage(String message, Component editorComponent) {
JOptionPane.showMessageDialog(editorComponent, message, "Validation Error", JOptionPane.ERROR_MESSAGE);
}
}

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

@ -2,7 +2,8 @@ package com.fr.design.widget;
import com.fr.design.data.DataCreatorUI;
import javax.swing.*;
import javax.swing.JComponent;
public interface DataModify<T> {
@ -15,4 +16,9 @@ public interface DataModify<T> {
DataCreatorUI dataUI();
JComponent toSwingComponent();
String getGlobalName();
void setGlobalName(String globalName);
}

105
designer_base/src/com/fr/env/RemoteEnv.java vendored

@ -1,7 +1,16 @@
package com.fr.env;
import com.fr.base.*;
import com.fr.base.AbstractEnv;
import com.fr.base.EnvException;
import com.fr.base.FRContext;
import com.fr.base.FRCoreContext;
import com.fr.base.ModifiedTable;
import com.fr.base.Parameter;
import com.fr.base.StoreProcedureParameter;
import com.fr.base.TableData;
import com.fr.base.Utils;
import com.fr.base.remote.RemoteDeziConstants;
import com.fr.data.TableDataSource;
import com.fr.data.core.DataCoreUtils;
import com.fr.data.core.db.TableProcedure;
import com.fr.data.impl.Connection;
@ -21,13 +30,25 @@ import com.fr.file.CacheManager;
import com.fr.file.DatasourceManager;
import com.fr.file.DatasourceManagerProvider;
import com.fr.file.filetree.FileNode;
import com.fr.general.*;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.general.LogRecordTime;
import com.fr.general.VT4FR;
import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import com.fr.share.ShareConstants;
import com.fr.stable.*;
import com.fr.stable.ArrayUtils;
import com.fr.stable.EncodeConstants;
import com.fr.stable.JavaCompileInfo;
import com.fr.stable.LicUtils;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.SvgProvider;
import com.fr.stable.file.XMLFileManagerProvider;
import com.fr.stable.project.ProjectConstants;
import com.fr.stable.xml.XMLPrintWriter;
@ -35,18 +56,40 @@ import com.fr.stable.xml.XMLTools;
import com.fr.stable.xml.XMLableReader;
import com.fr.web.ResourceConstants;
import javax.swing.*;
import javax.xml.transform.*;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import java.awt.*;
import java.io.*;
import java.awt.Component;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.NoRouteToHostException;
import java.net.Socket;
import java.util.*;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
import java.util.logging.Level;
import java.util.regex.Pattern;
@ -112,6 +155,15 @@ public class RemoteEnv extends AbstractEnv {
return password;
}
// 修复密码中包含特殊字符,无法登录的问题
private String getEncodedPassword() {
try {
return URLEncoder.encode(password, "UTF-8");
} catch (UnsupportedEncodingException e) {
return password;
}
}
public void setPassword(String password) {
this.password = password;
clearUserID();
@ -175,12 +227,8 @@ public class RemoteEnv extends AbstractEnv {
* 根据nameValuePairs,也就是参数对,生成PostMethod,不同之处在于,参数拼在path后面,不是method.addParameters
*/
private HttpClient createHttpMethod2(HashMap<String, String> para) throws EnvException {
StringBuilder sb = new StringBuilder(path);
sb.append('?');
sb.append("id=").append(createUserID());
return new HttpClient(sb.toString(), para, true);
String methodPath = path + '?' + "id=" + createUserID();
return new HttpClient(methodPath, para, true);
}
@ -337,7 +385,7 @@ public class RemoteEnv extends AbstractEnv {
para.put("op", "fr_remote_design");
para.put("cmd", "test_server_connection");
para.put("user", user);
para.put("password", password);
para.put("password", getEncodedPassword());
if (path.startsWith("https") && (!DesignerEnvManager.getEnvManager().isHttps())) {
return false;
@ -362,7 +410,7 @@ public class RemoteEnv extends AbstractEnv {
Inter.getLocText(new String[]{"Datasource-Connection_failed", "Registration-User_Name", "Password", "Error"}, new String[]{",", "", "", "!"})
, Inter.getLocText("FR-Server-All_Error"), JOptionPane.ERROR_MESSAGE);
return false;
} else if (res.indexOf("RegistEditionException") != -1) {
} else if (res.contains("RegistEditionException")) {
if (needMessage) {
JOptionPane.showMessageDialog(parentComponent, Inter.getLocText(new String[]{"Datasource-Connection_failed", "Version-does-not-support"}, new String[]{",", "!"}));
} else {
@ -415,9 +463,8 @@ public class RemoteEnv extends AbstractEnv {
para.put("op", "fr_remote_design");
para.put("cmd", "heart_beat");
para.put("user", user);
para.put("userid", userID);
HttpClient client = createHttpMethod(para, true);
HttpClient client = createHttpMethod(para);
execute4InputStream(client);
//这做法不好, 30秒刷一次, 刷新的时候会重新构建树, 构建完会把子节点都收缩起来, 效果太差.
@ -459,7 +506,7 @@ public class RemoteEnv extends AbstractEnv {
para.put("op", "fr_remote_design");
para.put("cmd", "r_sign_in");
para.put("user", user);
para.put("password", password);
para.put("password", getEncodedPassword());
simulaRPC(para, true);
@ -552,7 +599,7 @@ public class RemoteEnv extends AbstractEnv {
if (resJSON == null) {
return false;
}
if (resJSON.indexOf("RegistEditionException") != -1) {
if (resJSON.contains("RegistEditionException")) {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Lic_does_not_Support_Remote"));
return false;
}
@ -1207,6 +1254,11 @@ public class RemoteEnv extends AbstractEnv {
return DavXMLUtils.readXMLParameters(input);
}
@Override
public EmbeddedTableData previewTableData(Object tableData, Map parameterMap, int rowCount) throws Exception {
return previewTableData(null, tableData, parameterMap, rowCount);
}
/**
* 根据指定的参数生成一个实际可预览的数据集
*
@ -1216,7 +1268,7 @@ public class RemoteEnv extends AbstractEnv {
* @return 实际的二维数据集
* @throws Exception 如果生成数据失败则抛出此异常
*/
public EmbeddedTableData previewTableData(Object tableData, java.util.Map parameterMap, int rowCount) throws Exception {
public EmbeddedTableData previewTableData(TableDataSource dataSource, Object tableData, java.util.Map parameterMap, int rowCount) throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream();
// 把tableData写成xml文件到out
@ -1255,6 +1307,11 @@ public class RemoteEnv extends AbstractEnv {
return previewTableData(tableData, parameterMap, -1);
}
@Override
public Object previewTableData(TableDataSource dataSource, Object tableData, Map parameterMap, int start, int end, String[] cols, int[] colIdx) throws Exception {
return previewTableData(dataSource, tableData, parameterMap, -1);
}
/**
* nameValuePairs,这个参数要接着this.path,拼成一个URL,否则服务器端req.getParameter是无法得到的
*
@ -1939,7 +1996,7 @@ public class RemoteEnv extends AbstractEnv {
para.put("op", "fr_remote_design");
para.put("cmd", "design_get_designer_version");
para.put("user", user);
para.put("password", password);
para.put("password", getEncodedPassword());
HttpClient client = createHttpMethod(para, true);
try {
@ -2160,6 +2217,10 @@ public class RemoteEnv extends AbstractEnv {
return StringUtils.EMPTY;
}
}
public void doWhenServerShutDown() {
}
@Override
public boolean isLocalEnv() {

38
designer_form/src/com/fr/design/mainframe/JForm.java

@ -13,7 +13,12 @@ import com.fr.design.designer.beans.actions.FormDeleteAction;
import com.fr.design.designer.beans.actions.PasteAction;
import com.fr.design.designer.beans.events.DesignerEditListener;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.*;
import com.fr.design.designer.creator.XComponent;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWAbsoluteBodyLayout;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.designer.properties.FormWidgetAuthorityEditPane;
import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener;
@ -54,8 +59,17 @@ import com.fr.stable.ArrayUtils;
import com.fr.stable.Constants;
import com.fr.stable.bridge.StableFactory;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
@ -552,6 +566,24 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
}
@Override
public void setTarget(Form form) {
if (this.formDesign == null) {
super.setTarget(form);
return;
}
this.formDesign.setTarget(form);
}
@Override
public Form getTarget() {
if (this.formDesign == null) {
return super.getTarget();
}
return this.formDesign.getTarget();
}
@Override
protected FormModelAdapter createDesignModel() {
return new FormModelAdapter(this);

21
designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleElementCaseToolBarEditor.java

@ -2,14 +2,18 @@ package com.fr.design.mainframe.widget.accessibles;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.core.WidgetOption;
import com.fr.design.mainframe.FormWebWidgetConstants;
import com.fr.design.mainframe.widget.editors.ElementCaseToolBarPane;
import com.fr.design.mainframe.widget.editors.ITextComponent;
import com.fr.design.mainframe.widget.editors.TextField;
import com.fr.design.mainframe.widget.wrappers.ElementCaseToolBarWrapper;
import com.fr.form.web.FormToolBarManager;
import com.fr.general.Inter;
import com.fr.stable.ArrayUtils;
import javax.swing.*;
import javax.swing.SwingUtilities;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -54,4 +58,19 @@ public class AccessibleElementCaseToolBarEditor extends UneditableAccessibleEdit
options.addAll(defaultOptions);
return options.toArray(new WidgetOption[options.size()]);
}
protected ITextComponent createTextField() {
TextField textField = new TextField() {
public void registerChangeListener(UIObserverListener listener) {
return;
}
public boolean shouldResponseChangeListener() {
return false;
}
};
textField.setGlobalName(Inter.getLocText("Form-EC_toolbar"));
return textField;
}
}

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

@ -18,11 +18,15 @@ import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WScaleLayout;
import com.fr.form.ui.container.WTitleLayout;
import com.fr.form.ui.widget.CRBoundsWidget;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPanel;
import java.awt.BorderLayout;
/**
* Created by ibm on 2017/7/25.
@ -199,13 +203,19 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
public void updateCreator() {
currentEditorDefinePane.setGlobalName(getGlobalName());
Widget widget = currentEditorDefinePane.updateBean();
widgetPropertyPane.update(widget);
if (widgetBoundPane != null) {
if(ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Widget_Name"))){
widgetPropertyPane.update(widget);
xCreator.resetCreatorName(widget.getWidgetName());
designer.getEditListenerTable().fireCreatorModified(xCreator, DesignerEvent.CREATOR_RENAMED);
return;
}
if (widgetBoundPane != null && ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Coords_And_Size"))) {
widgetBoundPane.update();
}
xCreator.resetCreatorName(widget.getWidgetName());
designer.getEditListenerTable().fireCreatorModified(xCreator, DesignerEvent.CREATOR_RENAMED);
fireValueChanged();
}

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

@ -5,13 +5,15 @@ import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.widget.DataModify;
import javax.swing.*;
import javax.swing.JComponent;
/**
* Created by kerry on 17/07/28.
*/
public abstract class AbstractDataModify<T> extends BasicBeanPane<T> implements DataModify<T> {
protected XCreator creator;
protected String globalName;
public AbstractDataModify(XCreator xCreator){
@ -28,5 +30,11 @@ public abstract class AbstractDataModify<T> extends BasicBeanPane<T> implements
return this;
}
public void setGlobalName(String globalName){
this.globalName = globalName;
}
public String getGlobalName(){
return globalName;
}
}

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

@ -20,7 +20,9 @@ import com.fr.script.Calculator;
import com.fr.stable.ArrayUtils;
import com.fr.stable.UtilEvalError;
import javax.swing.*;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
@ -38,6 +40,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(XCreator xCreator) {
super(xCreator);
@ -64,12 +67,12 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Label_Name")), labelNameTextField},
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Estate_Widget_Value")), formWidgetValuePane},
new Component[]{new UILabel(Inter.getLocText("FR-Engine_Format") + ":"), formatHead},
new Component[]{new UILabel(Inter.getLocText("FS_Start_Date") + ":"), startDv},
new Component[]{new UILabel(Inter.getLocText("FS_End_Date") + ":"), endDv},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_WaterMark") + ":"), waterMarkDictPane},
new Component[]{new UILabel(Inter.getLocText("FR-Engine_Format")), formatHead},
new Component[]{new UILabel(Inter.getLocText("FS_Start_Date")), startDv},
new Component[]{new UILabel(Inter.getLocText("FS_End_Date")), endDv},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_WaterMark")), waterMarkDictPane},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Font-Size")), fontSizePane},
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, p, p, p};
@ -85,7 +88,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);
@ -93,7 +102,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;

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

@ -11,13 +11,16 @@ import com.fr.form.ui.AbstractMarginWidget;
import com.fr.form.ui.PaddingMargin;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.Component;
/**
* Created by ibm on 2017/8/3.
*/
public class PaddingBoundPane extends BasicPane {
public class PaddingBoundPane extends BasicPane{
protected UISpinner top;
protected UISpinner bottom;
protected UISpinner left;
@ -33,6 +36,10 @@ public class PaddingBoundPane extends BasicPane {
bottom = new UISpinner(0, 1000, 1, 0);
left = new UISpinner(0, 1000, 1, 0);
right = new UISpinner(0, 1000, 1, 0);
top.setGlobalName(Inter.getLocText("FR-Designer_Layout-Padding"));
bottom.setGlobalName(Inter.getLocText("FR-Designer_Layout-Padding"));
left.setGlobalName(Inter.getLocText("FR-Designer_Layout-Padding"));
right.setGlobalName(Inter.getLocText("FR-Designer_Layout-Padding"));
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p};
@ -47,9 +54,9 @@ public class PaddingBoundPane extends BasicPane {
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1);
panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 0));
this.add(panel);
}
public void update(AbstractMarginWidget marginWidget) {
marginWidget.setMargin(new PaddingMargin((int)top.getValue(), (int)left.getValue(), (int)bottom.getValue(), (int)right.getValue() ));
}
@ -66,4 +73,5 @@ public class PaddingBoundPane extends BasicPane {
right.setValue(paddingMargin.getRight());
}
}

31
designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java

@ -1,26 +1,23 @@
package com.fr.design.widget.ui.designer.component;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.widget.WidgetBoundsPaneFactory;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WLayout;
import com.fr.general.Inter;
import java.awt.Rectangle;
import java.awt.*;
/**
* Created by ibm on 2017/8/3.
*/
public class WidgetAbsoluteBoundPane extends WidgetBoundPane {
protected XWAbsoluteLayout parent;
private UISpinner x;
private UISpinner y;
public WidgetAbsoluteBoundPane(XCreator source){
super(source);
XLayoutContainer xLayoutContainer = getParent(source);
this.parent = (XWAbsoluteLayout) xLayoutContainer;
}
public void initBoundPane() {
@ -28,6 +25,10 @@ public class WidgetAbsoluteBoundPane extends WidgetBoundPane {
y = new UISpinner(0, 1200, 1);
width = new UISpinner(0, 1200, 1);
height = new UISpinner(0, 1200, 1);
x.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size"));
y.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size"));
width.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size"));
height.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size"));
this.add(WidgetBoundsPaneFactory.createAbsoluteBoundsPane(x, y, width, height));
}
@ -40,13 +41,25 @@ public class WidgetAbsoluteBoundPane extends WidgetBoundPane {
if (parent == null) {
return;
}
WAbsoluteLayout wabs = parent.toData();
WLayout wabs = parent.toData();
wabs.setBounds(creator.toData(), bounds);
creator.setBounds(bounds);
}
public void limitWidth(WLayout wabs, int w, Rectangle bounds, Rectangle rec){
bounds.width = w;
}
public void limitHeight(WLayout wabs, int h, Rectangle bounds, Rectangle rec){
bounds.height = h;
}
protected String title4PopupWindow() {
return "";
return "absoluteBound";
}
public void populate() {

115
designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java

@ -1,18 +1,33 @@
package com.fr.design.widget.ui.designer.component;
import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.adapters.layout.FRFitLayoutAdapter;
import com.fr.design.designer.creator.*;
import com.fr.design.designer.creator.cardlayout.XWCardLayout;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.utils.ComponentUtils;
import com.fr.design.widget.WidgetBoundsPaneFactory;
import com.fr.form.ui.PaddingMargin;
import com.fr.form.ui.container.WFitLayout;
import com.fr.form.ui.container.WLayout;
import com.fr.general.Inter;
import javax.swing.JOptionPane;
import java.awt.Rectangle;
import java.awt.*;
/**
* Created by ibm on 2017/7/30.
*/
public class WidgetBoundPane extends BasicPane {
private static final int MINHEIGHT = WLayout.MIN_HEIGHT;
private static final int MINWIDTH = WLayout.MIN_WIDTH;
protected XLayoutContainer parent;
protected XCreator creator;
protected UISpinner width;
protected UISpinner height;
@ -20,6 +35,7 @@ public class WidgetBoundPane extends BasicPane {
public WidgetBoundPane(XCreator source) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.creator = source;
this.parent = getParent(source);
initBoundPane();
}
@ -34,19 +50,22 @@ public class WidgetBoundPane extends BasicPane {
public void initBoundPane() {
width = new UISpinner(0, 1200, 1);
height = new UISpinner(0, 1200, 1);
width.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size"));
height.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size"));
if (creator.acceptType(XWCardLayout.class)) {
width.setEnabled(false);
height.setEnabled(false);
}
this.add(WidgetBoundsPaneFactory.createBoundsPane(width, height));
}
public void update() {
Rectangle bounds = new Rectangle(creator.getBounds());
bounds.width = (int) width.getValue();
bounds.height = (int) height.getValue();
creator.setBounds(bounds);
fix();
}
protected String title4PopupWindow() {
return "";
return "widgetBound";
}
public void populate() {
@ -54,4 +73,88 @@ public class WidgetBoundPane extends BasicPane {
width.setValue(bounds.width);
height.setValue(bounds.height);
}
public void fix() {
Rectangle bounds = new Rectangle(creator.getBounds());
int w = (int) width.getValue();
int h = (int) height.getValue();
Rectangle rec = ComponentUtils.getRelativeBounds(parent);
WLayout wabs = parent.toData();
if (bounds.width != w) {
limitWidth(wabs, w, bounds, rec);
}
if (bounds.height != h) {
limitHeight(wabs, h, bounds, rec);
}
creator.setBounds(bounds);
}
public void adjustComponents(Rectangle bounds, int difference, int row) {
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
Rectangle backupBounds = getBound();
FRFitLayoutAdapter layoutAdapter = (FRFitLayoutAdapter) AdapterBus.searchLayoutAdapter(formDesigner, creator);
if (layoutAdapter != null) {
layoutAdapter.setEdit(true);
layoutAdapter.calculateBounds(backupBounds, bounds, creator, row, difference);
}
}
public void limitWidth(WLayout wabs, int w, Rectangle bounds, Rectangle rec) {
int difference = 0;
int minWidth = (int) (MINWIDTH * ((WFitLayout) wabs).getResolutionScaling());
PaddingMargin margin = wabs.getMargin();
if (bounds.width != w) {
if (bounds.width == rec.width - margin.getLeft() - margin.getRight()) {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Beyond_Bounds"));
width.setValue(bounds.width);
return;
} else if (w < minWidth) {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Min_Width") + Integer.toString(minWidth));
width.setValue(bounds.width);
return;
}
difference = bounds.width - w;
bounds.width = w;
}
width.setValue(bounds.width);
wabs.setBounds(creator.toData(), bounds);
adjustComponents(bounds, difference, 0);
}
public void limitHeight(WLayout wabs, int h, Rectangle bounds, Rectangle rec) {
int difference = 0;
PaddingMargin margin = wabs.getMargin();
int minHeight = (int) (MINHEIGHT * ((WFitLayout) wabs).getResolutionScaling());
if (bounds.height != h) {
if (bounds.height == rec.height - margin.getTop() - margin.getBottom()) {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Beyond_Bounds"));
height.setValue(bounds.height);
return;
} else if (h < minHeight) {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Min_Height") + Integer.toString(minHeight));
height.setValue(bounds.height);
return;
}
difference = bounds.height - h;
bounds.height = h;
}
wabs.setBounds(creator.toData(), bounds);
creator.setBounds(bounds);
adjustComponents(bounds, difference, 1);
}
public Rectangle getBound() {
Rectangle bounds = new Rectangle(creator.getBounds());
if (parent == null) {
return bounds;
}
Rectangle rec = ComponentUtils.getRelativeBounds(parent);
bounds.x += rec.x;
bounds.y += rec.y;
return bounds;
}
}

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

@ -8,10 +8,13 @@ import com.fr.design.mainframe.widget.accessibles.AccessibleElementCaseToolBarEd
import com.fr.design.widget.ui.designer.component.PaddingBoundPane;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.web.FormToolBarManager;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
/**
* Created by ibm on 2017/8/7.
@ -45,8 +48,13 @@ public class ElementEditorDefinePane extends WTitleLayoutDefinePane<ElementCaseE
protected ElementCaseEditor updateSubBean() {
ElementCaseEditor elementCaseEditor = (ElementCaseEditor) creator.toData();
paddingBoundPane.update(elementCaseEditor);
elementCaseEditor.setToolBars((FormToolBarManager[]) elementCaseToolBarEditor.getValue());
if(ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Layout-Padding"))){
paddingBoundPane.update(elementCaseEditor);
}
if(ComparatorUtils.equals(getGlobalName(), Inter.getLocText("Form-EC_toolbar"))){
elementCaseEditor.setToolBars((FormToolBarManager[]) elementCaseToolBarEditor.getValue());
}
return elementCaseEditor;
}

46
designer_form/src/com/fr/design/widget/ui/designer/layout/WTabFitLayoutDefinePane.java

@ -2,6 +2,9 @@ package com.fr.design.widget.ui.designer.layout;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.cardlayout.XWCardLayout;
import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
@ -11,11 +14,17 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.ui.designer.AbstractDataModify;
import com.fr.design.widget.ui.designer.component.PaddingBoundPane;
import com.fr.design.widget.ui.designer.component.TabFitLayoutBackgroundPane;
import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.form.ui.container.cardlayout.WCardTitleLayout;
import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
/**
* Created by ibm on 2017/8/5.
@ -70,16 +79,47 @@ public class WTabFitLayoutDefinePane extends AbstractDataModify<WTabFitLayout> {
borderStyle.populate(ob);
paddingBoundPane.populate(ob);
componentInterval.setValue(ob.getCompInterval());
if(ob.getCurrentCard() == null){
ob.setCurrentCard(getRelateSwitchButton(ob));
}
titleField.setText(ob.getCurrentCard().getText());
}
private CardSwitchButton getRelateSwitchButton(WTabFitLayout layout){
int index = layout.getIndex();
XWCardLayout cardLayout = (XWCardLayout)creator.getBackupParent();
XWCardMainBorderLayout border = (XWCardMainBorderLayout)cardLayout.getBackupParent();
WCardMainBorderLayout borderLayout = border.toData();
WCardTitleLayout titleLayout = borderLayout.getTitlePart();
if(titleLayout == null){
return null;
}
WCardTagLayout tagLayout = titleLayout.getTagPart();
return tagLayout == null ? null : tagLayout.getSwitchButton(index);
}
private void setLayoutGap(int gap, WTabFitLayout layout, XWTabFitLayout xwTabFitLayout) {
if(xwTabFitLayout.canAddInterval(gap)){
int interval = layout.getCompInterval();
if (gap != interval) {
xwTabFitLayout.moveContainerMargin();
xwTabFitLayout.moveCompInterval(xwTabFitLayout.getAcualInterval());
layout.setCompInterval(gap);
xwTabFitLayout.addCompInterval(xwTabFitLayout.getAcualInterval());
}
}
}
@Override
public WTabFitLayout updateBean() {
WTabFitLayout layout = (WTabFitLayout) creator.toData();
borderStyle.update(layout);
paddingBoundPane.update(layout);
layout.setCompInterval((int)componentInterval.getValue());
int gap = (int)componentInterval.getValue();
setLayoutGap(gap, layout, (XWTabFitLayout)creator);
layout.getCurrentCard().setText(titleField.getText());
return layout;
}

19
designer_form/src/com/fr/design/widget/ui/designer/layout/WTitleLayoutDefinePane.java

@ -2,20 +2,22 @@ package com.fr.design.widget.ui.designer.layout;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.accessibles.AccessibleWLayoutBorderStyleEditor;
import com.fr.design.widget.ui.designer.AbstractDataModify;
import com.fr.design.widget.ui.designer.component.PaddingBoundPane;
import com.fr.form.ui.*;
import com.fr.form.ui.container.WTitleLayout;
import com.fr.form.ui.AbstractBorderStyleWidget;
import com.fr.form.ui.LayoutBorderStyle;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
/**
* Created by ibm on 2017/8/3.
@ -32,7 +34,6 @@ public abstract class WTitleLayoutDefinePane<T extends AbstractBorderStyleWidget
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel advancePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
borderStyleEditor = new AccessibleWLayoutBorderStyleEditor();
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p};
@ -74,7 +75,9 @@ public abstract class WTitleLayoutDefinePane<T extends AbstractBorderStyleWidget
@Override
public T updateBean() {
T e = updateSubBean();
e.setBorderStyle((LayoutBorderStyle) borderStyleEditor.getValue());
if(!ComparatorUtils.equals(borderStyleEditor.getValue(), e.getBorderStyle())){
e.setBorderStyle((LayoutBorderStyle) borderStyleEditor.getValue());
}
return e;
}

Loading…
Cancel
Save