Browse Source

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

master
mengao 8 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. 12
      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. 3
      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. 13
      designer_base/src/com/fr/design/gui/icombobox/UIComboBoxRenderer.java
  35. 1
      designer_base/src/com/fr/design/gui/itree/checkboxtree/NullTristateCheckBox.java
  36. BIN
      designer_base/src/com/fr/design/images/buttonicon/leftNormal.png
  37. BIN
      designer_base/src/com/fr/design/images/m_format/cellstyle/bold_white.png
  38. BIN
      designer_base/src/com/fr/design/images/m_format/cellstyle/h_center_normal_white.png
  39. BIN
      designer_base/src/com/fr/design/images/m_format/cellstyle/h_left_normal_white.png
  40. BIN
      designer_base/src/com/fr/design/images/m_format/cellstyle/h_right_normal_white.png
  41. BIN
      designer_base/src/com/fr/design/images/m_format/cellstyle/italic_white.png
  42. BIN
      designer_base/src/com/fr/design/images/m_format/cellstyle/underline_white.png
  43. 1817
      designer_base/src/com/fr/design/mainframe/DesignerFrame.java
  44. 213
      designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  45. 12
      designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java
  46. 8
      designer_base/src/com/fr/design/mainframe/widget/BasicPropertyPane.java
  47. 41
      designer_base/src/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java
  48. 8
      designer_base/src/com/fr/design/widget/DataModify.java
  49. 105
      designer_base/src/com/fr/env/RemoteEnv.java
  50. 38
      designer_form/src/com/fr/design/mainframe/JForm.java
  51. 21
      designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleElementCaseToolBarEditor.java
  52. 22
      designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java
  53. 10
      designer_form/src/com/fr/design/widget/ui/designer/AbstractDataModify.java
  54. 31
      designer_form/src/com/fr/design/widget/ui/designer/DateEditorDefinePane.java
  55. 16
      designer_form/src/com/fr/design/widget/ui/designer/component/PaddingBoundPane.java
  56. 31
      designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java
  57. 115
      designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java
  58. 16
      designer_form/src/com/fr/design/widget/ui/designer/layout/ElementEditorDefinePane.java
  59. 46
      designer_form/src/com/fr/design/widget/ui/designer/layout/WTabFitLayoutDefinePane.java
  60. 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; package com.fr.design.actions.cell.style;
import javax.swing.Icon;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.chart.BaseChartCollection; import com.fr.base.chart.BaseChartCollection;
import com.fr.design.constants.UIConstants;
import com.fr.design.actions.ButtonGroupAction; import com.fr.design.actions.ButtonGroupAction;
import com.fr.design.actions.utils.ReportActionUtils; import com.fr.design.actions.utils.ReportActionUtils;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIButtonGroup; 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.design.mainframe.ElementCasePane;
import com.fr.general.Inter;
import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection; import com.fr.grid.selection.Selection;
import com.fr.report.cell.FloatElement; import com.fr.report.cell.FloatElement;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.Constants;
import javax.swing.*;
public class AlignmentAction extends ButtonGroupAction implements StyleActionInterface { public class AlignmentAction extends ButtonGroupAction implements StyleActionInterface {
public AlignmentAction(ElementCasePane t, Icon[] iconArray, private static final Icon[] normalBlackIcon = new Icon[]{
Integer[] valueArray) { BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"),
super(t, iconArray, valueArray); 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"),
* executeStyle 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")};
* @param style
* @param selectedStyle private static final Integer[] valueArray = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT};
* @return style
*/ public AlignmentAction(ElementCasePane t) {
public Style executeStyle(Style style, Style selectedStyle) { super(t, normalBlackIcon, valueArray);
return style.deriveHorizontalAlignment(getSelectedValue()); }
}
/** /**
* 更新Style * executeStyle
* *
* @param style style * @param style
*/ * @param selectedStyle
public void updateStyle(Style style) { * @return style
setSelectedIndex(BaseUtils.getAlignment4Horizontal(style)); */
} public Style executeStyle(Style style, Style selectedStyle) {
return style.deriveHorizontalAlignment(getSelectedValue());
/** }
* executeActionReturnUndoRecordNeeded
* /**
* @return * 更新Style
*/ *
public boolean executeActionReturnUndoRecordNeeded() { * @param style style
ElementCasePane reportPane = this.getEditingComponent(); */
if (reportPane == null) { public void updateStyle(Style style) {
return false; UIButtonGroup<Integer> buttonGroup = createToolBarComponent();
} int selected = BaseUtils.getAlignment4Horizontal(style);
for (int i = 0; i < normalBlackIcon.length; i++) {
return ReportActionUtils.executeAction(this, reportPane); UIToggleButton button = buttonGroup.getButton(i);
} Icon currentIcon = button.getIcon();
Icon newIcon = selected == valueArray[i] ? toggleWhiteIcon[i] : normalBlackIcon[i];
/** if (newIcon != currentIcon) {
* update button.setIcon(newIcon);
*/ }
public void update() { }
super.update(); setSelectedIndex(selected);
}
//peter:如果当前没有ReportFrame,不需要继续.
if (!this.isEnabled()) { /**
return; * executeActionReturnUndoRecordNeeded
} *
* @return
//got simple cell element from row and column */
ElementCasePane reportPane = this.getEditingComponent(); public boolean executeActionReturnUndoRecordNeeded() {
if (reportPane == null) { ElementCasePane reportPane = this.getEditingComponent();
this.setEnabled(false); if (reportPane == null) {
return; return false;
} }
Selection cs = reportPane.getSelection();
TemplateElementCase tplEC = reportPane.getEditingElementCase(); return ReportActionUtils.executeAction(this, reportPane);
}
if (tplEC != null && cs instanceof FloatSelection) {
FloatElement selectedFloat = tplEC.getFloatElement(((FloatSelection) cs).getSelectedFloatName()); /**
Object value = selectedFloat.getValue(); * update
if (value instanceof BaseChartCollection) { */
this.setEnabled(false); public void update() {
return; super.update();
}
} //peter:如果当前没有ReportFrame,不需要继续.
this.updateStyle(ReportActionUtils.getCurrentStyle(reportPane)); if (!this.isEnabled()) {
} return;
}
/**
* 创建工具条且有提示 //got simple cell element from row and column
* ElementCasePane reportPane = this.getEditingComponent();
* @return if (reportPane == null) {
*/ this.setEnabled(false);
public UIButtonGroup<Integer> createToolBarComponent() { return;
UIButtonGroup<Integer> group = super.createToolBarComponent(); }
if (group != null) { Selection cs = reportPane.getSelection();
group.setForToolBarButtonGroup(true); TemplateElementCase tplEC = reportPane.getEditingElementCase();
group.setAllToolTips(new String[]{Inter.getLocText("StyleAlignment-Left"), Inter.getLocText("Center"), Inter.getLocText("StyleAlignment-Right")});
} if (tplEC != null && cs instanceof FloatSelection) {
for (int i = 0; i < 3; i++) { FloatElement selectedFloat = tplEC.getFloatElement(((FloatSelection) cs).getSelectedFloatName());
group.getButton(i).setRoundBorder(true, UIConstants.ARC); Object value = selectedFloat.getValue();
group.getButton(i).setBorderPainted(true); if (value instanceof BaseChartCollection) {
} this.setEnabled(false);
return group; 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.base.core.StyleUtils;
import com.fr.design.actions.ToggleButtonUpdateAction; import com.fr.design.actions.ToggleButtonUpdateAction;
import com.fr.design.gui.ibutton.UIToggleButton; 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.mainframe.ElementCasePane;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont;
import com.fr.general.Inter;
import javax.swing.*;
/** /**
* Bold. * Bold.
*/ */
public class ReportFontBoldAction extends AbstractStyleAction implements ToggleButtonUpdateAction { public class ReportFontBoldAction extends AbstractStyleAction implements ToggleButtonUpdateAction {
private UIToggleButton button; private UIToggleButton button;
protected Style style; 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) { this.setName(Inter.getLocText("FRFont-bold"));
super(t); 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);
}
/** return this.style;
* 根据按钮状态获取格式 }
*
* @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; protected Icon getToggleButtonIcon(boolean isSelected) {
} return isSelected ? blackIcon : whiteIcon;
}
protected void setSelectedFont(Style style) { protected void setSelectedFont(Style style) {
this.style = StyleUtils.boldReportFont(style); this.style = StyleUtils.boldReportFont(style);
} }
protected void setUnselectedFont(Style style) { protected void setUnselectedFont(Style style) {
this.style = StyleUtils.unBoldReportFont(style); this.style = StyleUtils.unBoldReportFont(style);
} }
/** /**
* Update Style. * Update Style.
*/ */
@Override @Override
public void updateStyle(Style style) { public void updateStyle(Style style) {
if (style == null) { if (style == null) {
return; return;
} }
FRFont frFont = style.getFRFont(); FRFont frFont = style.getFRFont();
if (frFont == null) { if (frFont == null) {
return; return;
} }
createToolBarComponent().setSelected(isStyle(frFont)); button = createToolBarComponent();
} button.setSelected(isStyle(frFont));
button.setIcon(getToggleButtonIcon(!button.isSelected()));
}
protected boolean isStyle(FRFont frFont) { protected boolean isStyle(FRFont frFont) {
return frFont.isBold(); return frFont.isBold();
} }
/** /**
* Gets component on toolbar. * Gets component on toolbar.
* *
* @return the created components on toolbar. * @return the created components on toolbar.
*/ */
@Override @Override
public UIToggleButton createToolBarComponent() { public UIToggleButton createToolBarComponent() {
if (button == null) { if (button == null) {
button = GUICoreUtils.createToolBarComponent(this); button = GUICoreUtils.createToolBarComponent(this);
button.setEventBannded(true); button.setEventBannded(true);
} }
return button; return button;
} }
} }

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

@ -10,16 +10,21 @@ import com.fr.general.FRFont;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import javax.swing.*;
/** /**
* Bold. * Bold.
*/ */
public class ReportFontItalicAction extends ReportFontBoldAction { 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); super(t);
this.setName(Inter.getLocText("FRFont-italic")); 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); this.style = StyleUtils.unItalicReportFont(style);
} }
protected Icon getToggleButtonIcon(boolean isSelected) {
return isSelected ? blackIcon : whiteIcon;
}
protected boolean isStyle(FRFont frFont) { protected boolean isStyle(FRFont frFont) {
return frFont.isItalic(); 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.design.mainframe.ElementCasePane;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import javax.swing.*;
/** /**
* Bold. * Bold.
*/ */
public class ReportFontUnderlineAction extends ReportFontBoldAction { 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); super(t);
this.setName(Inter.getLocText("FRFont-Underline")); 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) { protected void setSelectedFont (Style style) {
@ -30,6 +36,9 @@ public class ReportFontUnderlineAction extends ReportFontBoldAction {
this.style = StyleUtils.setReportFontUnderline(style, false); this.style = StyleUtils.setReportFontUnderline(style, false);
} }
protected Icon getToggleButtonIcon(boolean isSelected) {
return isSelected ? blackIcon : whiteIcon;
}
protected boolean isStyle(FRFont frFont) { protected boolean isStyle(FRFont frFont) {
return frFont.getUnderline() != Constants.LINE_NONE; return frFont.getUnderline() != Constants.LINE_NONE;

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

@ -3,34 +3,7 @@
*/ */
package com.fr.design.mainframe; package com.fr.design.mainframe;
import java.awt.AWTEvent; import com.fr.base.*;
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.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; 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.UpdateAction;
import com.fr.design.actions.cell.BorderAction; import com.fr.design.actions.cell.BorderAction;
import com.fr.design.actions.cell.CleanAuthorityAction; import com.fr.design.actions.cell.CleanAuthorityAction;
import com.fr.design.actions.cell.style.AlignmentAction; import com.fr.design.actions.cell.style.*;
import com.fr.design.actions.cell.style.ReportFontBoldAction; import com.fr.design.actions.columnrow.*;
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.core.ActionFactory; import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.edit.CopyAction; import com.fr.design.actions.edit.CopyAction;
import com.fr.design.actions.edit.CutAction; 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.ElementsTransferable;
import com.fr.design.cell.clipboard.FloatElementsClip; import com.fr.design.cell.clipboard.FloatElementsClip;
import com.fr.design.cell.editor.*; import com.fr.design.cell.editor.*;
import com.fr.design.cell.editor.CellEditor;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.designer.EditingState; import com.fr.design.designer.EditingState;
import com.fr.design.designer.TargetComponent; 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.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.cell.QuickEditorRegion; import com.fr.design.mainframe.cell.QuickEditorRegion;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.*;
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.selection.QuickEditor; import com.fr.design.selection.QuickEditor;
import com.fr.design.selection.Selectedable; import com.fr.design.selection.Selectedable;
import com.fr.design.selection.SelectionEvent; 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.ComparatorUtils;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.grid.Grid; import com.fr.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.dnd.ElementCasePaneDropTarget; import com.fr.grid.dnd.ElementCasePaneDropTarget;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.Selection; 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.report.elementcase.TemplateElementCase;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.ColumnRow; import com.fr.stable.ColumnRow;
import com.fr.stable.Constants;
import com.fr.stable.unit.FU; 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; 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. * Constructor.
*/ */
public ElementCasePane(T t) { public ElementCasePane(T t) {
super(t); super(t);
// marks:能触发processEvent,不管是否给component增加listener。这里是使在reportPane中的任意位置滑动鼠标轮都能 // marks:能触发processEvent,不管是否给component增加listener。这里是使在reportPane中的任意位置滑动鼠标轮都能
// 下拉grid。 // 下拉grid。
@ -209,7 +161,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
this.setLayout(new RGridLayout()); this.setLayout(new RGridLayout());
//todo 直接修改分辨率 //todo 直接修改分辨率
if (this.resolution == 0){ if (this.resolution == 0) {
this.resolution = ScreenResolution.getScreenResolution(); this.resolution = ScreenResolution.getScreenResolution();
} }
@ -243,7 +195,6 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
} }
public int getMenuState() { public int getMenuState() {
return DesignState.WORK_SHEET; return DesignState.WORK_SHEET;
} }
@ -294,8 +245,8 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
setFormatState(DesignerContext.FORMAT_STATE_NULL); setFormatState(DesignerContext.FORMAT_STATE_NULL);
formatBrush.setSelected(false); formatBrush.setSelected(false);
grid.setCursor(UIConstants.CELL_DEFAULT_CURSOR); grid.setCursor(UIConstants.CELL_DEFAULT_CURSOR);
if(DesignerContext.getReferencedElementCasePane() == null){ if (DesignerContext.getReferencedElementCasePane() == null) {
return; return;
} }
((ElementCasePane) DesignerContext.getReferencedElementCasePane()).getGrid().setNotShowingTableSelectPane(true); ((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; this.resolution = resolution;
} }
public int getResolution(){ public int getResolution() {
return this.resolution; return this.resolution;
} }
@ -1149,7 +1100,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
HeadColumnAction headcolumnAction = new HeadColumnAction(this); HeadColumnAction headcolumnAction = new HeadColumnAction(this);
FootColumnAction footcolumnAction = new FootColumnAction(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(); ElementCase elementCase = this.getEditingElementCase();
boolean cancel = false; boolean cancel = false;
ReportPageAttrProvider reportPageAttr = elementCase.getReportPageAttr(); ReportPageAttrProvider reportPageAttr = elementCase.getReportPageAttr();
@ -1267,11 +1218,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
protected ToolBarDef createAlignmentToolBar() { protected ToolBarDef createAlignmentToolBar() {
return ShortCut.asToolBarDef(new ShortCut[]{ return ShortCut.asToolBarDef(new ShortCut[]{
new AlignmentAction(this, new Icon[]{ new AlignmentAction(this)}
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})}
); );
} }

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++) { for (int i = 0; i < actions.length; i++) {
subMenuDef.addShortCut(actions[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 { public class ReportFloatPane extends JPanel {
private static ReportFloatPane THIS; private static ReportFloatPane THIS;
private ElementCasePaneDelegate elementCasePaneDelegate;
private MenuDef insertFloatMenu; private MenuDef insertFloatMenu;
private ReportFloatPane() { private ReportFloatPane() {
@ -37,12 +36,20 @@ public class ReportFloatPane extends JPanel {
return THIS; 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() { private void initComponent() {
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
UIToolbar topToolBar = new UIToolbar(); UIToolbar topToolBar = new UIToolbar();
topToolBar.setLayout(new BorderLayout()); topToolBar.setLayout(new BorderLayout());
insertFloatMenu = createInsertToolBar(); initInsertToolBar();
topToolBar.setPreferredSize(new Dimension(155,20)); topToolBar.setPreferredSize(new Dimension(155,20));
topToolBar.add(createButtonUI(), BorderLayout.CENTER); topToolBar.add(createButtonUI(), BorderLayout.CENTER);
topToolBar.setBorder(BorderFactory.createEmptyBorder(-1, -1, -1, -1)); topToolBar.setBorder(BorderFactory.createEmptyBorder(-1, -1, -1, -1));
@ -66,19 +73,14 @@ public class ReportFloatPane extends JPanel {
this.add(leftTopPane, BorderLayout.NORTH); this.add(leftTopPane, BorderLayout.NORTH);
} }
private MenuDef createInsertToolBar() { private void initInsertToolBar() {
MenuDef insertFloatMenu = new MenuDef(true); insertFloatMenu = new MenuDef(true);
insertFloatMenu.setName(KeySetUtils.INSERT_FLOAT.getMenuKeySetName()); insertFloatMenu.setName(KeySetUtils.INSERT_FLOAT.getMenuKeySetName());
insertFloatMenu.setTooltip(Inter.getLocText("FR-Designer_T_Insert_Float")); insertFloatMenu.setTooltip(Inter.getLocText("FR-Designer_T_Insert_Float"));
insertFloatMenu.setIconPath("com/fr/design/images/control/addPopup.png"); insertFloatMenu.setIconPath("com/fr/design/images/control/addPopup.png");
JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
elementCasePaneDelegate = (ElementCasePaneDelegate) editingTemplate.getCurrentElementCasePane(); ElementCasePaneDelegate elementCasePaneDelegate = (ElementCasePaneDelegate) editingTemplate.getCurrentElementCasePane();
UpdateAction[] actions = ActionFactory.createFloatInsertAction(ElementCasePane.class, elementCasePaneDelegate); refreshInsertFloatMenu(elementCasePaneDelegate);
for (int i = 0; i < actions.length; i++) {
insertFloatMenu.addShortCut(actions[i]);
}
return insertFloatMenu;
} }
private UIButton createButtonUI() { 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. * Created by XiaXiang on 2017/5/8.
*/ */
public class AlphaFineHelper { 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")); public static final NoResultModel NO_CONNECTION_MODEL = new NoResultModel(Inter.getLocText("FR-Designer_ConnectionFailed"));
private static AlphaFineDialog alphaFineDialog; 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; package com.fr.design.mainframe.alphafine.cell.model;
import com.fr.design.actions.UpdateAction;
import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.CellType;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.json.JSONException; import com.fr.json.JSONException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import javax.swing.*;
/** /**
* Created by XiaXiang on 2017/4/20. * Created by XiaXiang on 2017/4/20.
*/ */
public class ActionModel extends AlphaCellModel { 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); this(name, description, action);
setSearchCount(searchCount); setSearchCount(searchCount);
} }
public ActionModel(String name, String description, Action action) { public ActionModel(String name, String description, UpdateAction action) {
super(name, null, CellType.ACTION); super(name, null, CellType.ACTION);
this.action = action; this.action = action;
this.setDescription(description); this.setDescription(description);
@ -43,11 +42,11 @@ public class ActionModel extends AlphaCellModel {
return action != null ? action.hashCode() : 0; return action != null ? action.hashCode() : 0;
} }
public Action getAction() { public UpdateAction getAction() {
return action; return action;
} }
public void setAction(Action action) { public void setAction(UpdateAction action) {
this.action = action; this.action = action;
} }

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

@ -68,6 +68,7 @@ public abstract class AlphaCellModel implements Comparable {
public boolean isNeedToSendToServer() { public boolean isNeedToSendToServer() {
return true; return true;
} }
/** /**
* model转json * model转json
* *
@ -102,7 +103,7 @@ public abstract class AlphaCellModel implements Comparable {
@Override @Override
public int compareTo(Object o) { public int compareTo(Object o) {
AlphaCellModel cellModel = (AlphaCellModel)o; AlphaCellModel cellModel = (AlphaCellModel) o;
int difference = cellModel.getSearchCount() - this.getSearchCount(); int difference = cellModel.getSearchCount() - this.getSearchCount();
if (difference != 0) { if (difference != 0) {
return difference; 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.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.general.IOUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
@ -55,7 +54,7 @@ public class ContentCellRender implements ListCellRenderer<Object> {
detailLabel.setForeground(AlphaFineConstants.LIGHT_GRAY); detailLabel.setForeground(AlphaFineConstants.LIGHT_GRAY);
panel.add(detailLabel, BorderLayout.CENTER); panel.add(detailLabel, BorderLayout.CENTER);
int width = (int) (titleLabel.getPreferredSize().getWidth() + detailLabel.getPreferredSize().getWidth()); 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); int nameWidth = (int) (AlphaFineConstants.LEFT_WIDTH - detailLabel.getPreferredSize().getWidth() - OFFSET);
titleLabel.setPreferredSize(new Dimension(nameWidth, AlphaFineConstants.CELL_HEIGHT)); 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.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.general.IOUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.*; 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() { private void fireStopLoading() {
searchListModel.resetState();
if (searchResultPane != null) { if (searchResultPane != null) {
removeLeftPane(); removeLeftPane();
} }
@ -665,25 +664,18 @@ public class AlphaFineDialog extends UIDialog {
searchTextField.addKeyListener(new KeyAdapter() { searchTextField.addKeyListener(new KeyAdapter() {
@Override @Override
public void keyPressed(KeyEvent e) { public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_DOWN) { if (e.getKeyCode() == KeyEvent.VK_ENTER) {
searchResultList.requestFocus(); if (searchResultList.getModel().getSize() > 1) {
searchResultList.setSelectedIndex(searchResultList.getSelectedIndex() + 1); dealWithSearchResult(searchResultList.getSelectedValue());
}
}
@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();
} }
} else if (e.getKeyCode() == KeyEvent.VK_ENTER) { } else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
dealWithSearchResult(searchResultList.getSelectedValue()); 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() { private void doNavigate() {
AlphaFineDialog.this.dispose(); AlphaFineDialog.this.dispose();
final AlphaCellModel model = searchResultList.getSelectedValue(); final AlphaCellModel model = searchResultList.getSelectedValue();
model.doAction(); if (model != null) {
model.doAction();
}
} }
/** /**
@ -888,6 +882,21 @@ public class AlphaFineDialog extends UIDialog {
this.splitLabel = splitLabel; 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 @Override
public void setSelectedIndex(int index) { 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(); int previousIndex = getSelectedIndex();
super.setSelectedIndex(index); super.setSelectedIndex(index);
AlphaCellModel cellModel = getSelectedValue(); AlphaCellModel cellModel = getSelectedValue();
@ -930,21 +941,6 @@ public class AlphaFineDialog extends UIDialog {
} }
private void initListListener() { 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() { addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseClicked(MouseEvent e) { 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; package com.fr.design.mainframe.alphafine.component;
import com.bulenkov.iconloader.IconLoader;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.help.alphafine.AlphaFineContext; import com.fr.design.actions.help.alphafine.AlphaFineContext;
import com.fr.design.actions.help.alphafine.AlphaFineListener; 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.gui.ibutton.UIButton;
import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.utils.ThemeUtils; import com.fr.design.utils.ThemeUtils;
import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -22,12 +21,12 @@ public class AlphaFinePane extends BasicPane {
private static AlphaFinePane alphaFinePane; private static AlphaFinePane alphaFinePane;
public AlphaFinePane() { public AlphaFinePane() {
setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 14)); setLayout(new BorderLayout());
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isEnabled()) { if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isEnabled()) {
Toolkit.getDefaultToolkit().addAWTEventListener(AlphaFineDialog.listener(), AWTEvent.KEY_EVENT_MASK); Toolkit.getDefaultToolkit().addAWTEventListener(AlphaFineDialog.listener(), AWTEvent.KEY_EVENT_MASK);
} }
UIButton refreshButton = new UIButton(); 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.setToolTipText(Inter.getLocText("FR-Designer_AlphaFine"));
refreshButton.set4ToolbarButton(); refreshButton.set4ToolbarButton();
refreshButton.setRolloverEnabled(false); 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 widthScale = (AlphaFineConstants.RIGHT_WIDTH) / (float) image.getWidth();
float heightScale = (AlphaFineConstants.CONTENT_HEIGHT) / (float) image.getHeight(); float heightScale = (AlphaFineConstants.CONTENT_HEIGHT) / (float) image.getHeight();
Image showImage; 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)); label.setIcon(new ImageIcon(showImage));
add(label); 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.setPreferredSize(new Dimension(150, 111));
image.setHorizontalAlignment(SwingConstants.CENTER); image.setHorizontalAlignment(SwingConstants.CENTER);
image.setIcon(IconLoader.getIcon(iconUrl)); 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); UILabel description = new UILabel(title);
description.setForeground(AlphaFineConstants.MEDIUM_GRAY); description.setForeground(AlphaFineConstants.MEDIUM_GRAY);
description.setFont(FRFont.getInstance("SimSun", Font.PLAIN, 14)); 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.StringUtils;
import com.fr.stable.project.ProjectConstants; 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.ArrayList;
import java.util.List; 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) { if (jsonArray != null) {
SearchResult searchResult = new SearchResult(); SearchResult searchResult = new SearchResult();
for (int i = 0; i < jsonArray.length(); i++) { for (int i = 0; i < jsonArray.length(); i++) {
AlphaFineHelper.checkCancel();
PluginModel cellModel = getPluginModel(jsonArray.optJSONObject(i), false); PluginModel cellModel = getPluginModel(jsonArray.optJSONObject(i), false);
if (!AlphaFineHelper.getFilterResult().contains(cellModel)) { if (!AlphaFineHelper.getFilterResult().contains(cellModel)) {
searchResult.add(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.AlphaCellModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.toolbar.UpdateActionManager;
import com.fr.file.XMLFileManager; import com.fr.file.XMLFileManager;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger; 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.XMLTools;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
import java.io.*; import java.io.File;
import java.util.*; 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. * Created by XiaXiang on 2017/5/15.
@ -220,21 +230,24 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear
recentModelList = recentKVModelMap.get(searchText); recentModelList = recentKVModelMap.get(searchText);
SearchResult resultModelList = recentModelList; SearchResult resultModelList = recentModelList;
Iterator<AlphaCellModel> modelIterator = resultModelList.iterator(); Iterator<AlphaCellModel> modelIterator = resultModelList.iterator();
SearchResult searchResult = new SearchResult();
while (modelIterator.hasNext()) { while (modelIterator.hasNext()) {
AlphaCellModel model = modelIterator.next(); AlphaCellModel model = modelIterator.next();
if (model.getType() == CellType.ACTION && !((ActionModel) model).getAction().isEnabled()) { if (model.getType() == CellType.ACTION && !UpdateActionManager.getUpdateActionManager().isEnable(((ActionModel) model).getAction())) {
modelIterator.remove(); continue;
} else {
searchResult.add(model);
} }
} }
Collections.sort(resultModelList); Collections.sort(searchResult);
int size = resultModelList.size(); int size = searchResult.size();
if (size > MAX_SIZE) { if (size > MAX_SIZE) {
SearchResult result = new SearchResult(); SearchResult result = new SearchResult();
result.addAll(resultModelList.subList(0, MAX_SIZE)); result.addAll(searchResult.subList(0, MAX_SIZE));
return result; return result;
} }
return resultModelList; return searchResult;
} }
} }
return recentModelList; 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 ErrorInfoUploader collector;
private static boolean licSupport = true; private static boolean licSupport = true;
// 在一台不能上网的电脑里发现了10w个errorinfo...
private static final int MAX_ERROR_SIZE = 2000;
static { static {
GeneralContext.addEnvChangedListener(new EnvChangedListener() { GeneralContext.addEnvChangedListener(new EnvChangedListener() {
@ -123,6 +125,11 @@ public class ErrorInfoUploader {
} }
File[] files = folder.listFiles(); File[] files = folder.listFiles();
if (files.length > MAX_ERROR_SIZE) {
StableUtils.deleteFile(folder);
return;
}
try { try {
for (File file : files) { for (File file : files) {
String filePath = file.getPath(); String filePath = file.getPath();
@ -131,6 +138,11 @@ public class ErrorInfoUploader {
if (suffix.endsWith(SUFFIX)) { if (suffix.endsWith(SUFFIX)) {
Thread.sleep(1000L); Thread.sleep(1000L);
String content = IOUtils.inputStream2String(new FileInputStream(file)); String content = IOUtils.inputStream2String(new FileInputStream(file));
if (content.length() > MAX_ERROR_SIZE) {
file.delete();
continue;
}
String url = SiteCenter.getInstance().acquireUrlByKind("design.error"); String url = SiteCenter.getInstance().acquireUrlByKind("design.error");
if (sendErroInfo(url, content)) { if (sendErroInfo(url, content)) {
file.delete(); 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) { } else if (unitType == Constants.UNIT_INCH) {
this.setText(Inter.getLocText("FR-Designer_Unit_INCH")); this.setText(Inter.getLocText("FR-Designer_Unit_INCH"));
} else { } else {
this.setText(Inter.getLocText("FR-Designer_Unit_MM-mm")); this.setText(Inter.getLocText("FR-Designer_Unit_MM"));
} }
//ajust the heigt of unitLabel. //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.data.DataCreatorUI;
import com.fr.design.widget.DataModify; import com.fr.design.widget.DataModify;
import javax.swing.*; import javax.swing.JComponent;
/** /**
* Created by richie on 15/11/16. * Created by richie on 15/11/16.
*/ */
public abstract class AbstractDataModify<T> extends BasicBeanPane<T> implements DataModify<T> { public abstract class AbstractDataModify<T> extends BasicBeanPane<T> implements DataModify<T> {
protected String globalName;
@Override @Override
public DataCreatorUI dataUI() { public DataCreatorUI dataUI() {
@ -20,4 +22,12 @@ public abstract class AbstractDataModify<T> extends BasicBeanPane<T> implements
public JComponent toSwingComponent() { public JComponent toSwingComponent() {
return this; 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 UIComboBox currentFormatComboBox;
private UILabel currentSamplelabel; private UILabel currentSamplelabel;
private UIButtonGroup fomatHeadGroup; private UIButtonGroup fomatHeadGroup;
private static final int SAMPLE_LABEL_PADDING = 4;
public DateEditorDefinePane() { public DateEditorDefinePane() {
@ -76,7 +76,13 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
private JPanel createFormatPane(UIComboBox formatComboBox, UILabel sampleLabel){ private JPanel createFormatPane(UIComboBox formatComboBox, UILabel sampleLabel){
JPanel previewPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Base_StyleFormat_Sample")); 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 jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
jPanel.add(previewPane, BorderLayout.NORTH); jPanel.add(previewPane, BorderLayout.NORTH);
jPanel.add(formatComboBox, BorderLayout.CENTER); jPanel.add(formatComboBox, BorderLayout.CENTER);
@ -84,7 +90,13 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
} }
private UILabel createSamplePane(){ 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.setHorizontalAlignment(SwingConstants.CENTER);
sampleLabel.setFont(FRContext.getDefaultValues().getFRFont()); sampleLabel.setFont(FRContext.getDefaultValues().getFRFont());
return sampleLabel; return sampleLabel;

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

@ -135,26 +135,24 @@ public class Designer extends BaseDesigner {
public UILargeToolbar createLargeToolbar() { public UILargeToolbar createLargeToolbar() {
UILargeToolbar largeToolbar = super.createLargeToolbar(); UILargeToolbar largeToolbar = super.createLargeToolbar();
largeToolbar.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 4)); largeToolbar.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 4));
JPanel templeJpanel = new JPanel() { largeToolbar.add(new JPanel() {
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize(); Dimension dim = super.getPreferredSize();
dim.width = 1; dim.width = 1;
return dim; return dim;
} }
}; });
templeJpanel.setBackground(Color.WHITE);
largeToolbar.add(templeJpanel);
createRunButton(largeToolbar); createRunButton(largeToolbar);
largeToolbar.add(run); largeToolbar.add(run);
templeJpanel = new JPanel() { run.setBackground(UIConstants.TREE_BACKGROUND);
largeToolbar.add(new JPanel() {
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize(); Dimension dim = super.getPreferredSize();
dim.width = GAP; dim.width = GAP;
return dim; return dim;
} }
}; });
templeJpanel.setBackground(Color.WHITE); largeToolbar.addSeparator(new Dimension(2, 42));
largeToolbar.add(templeJpanel);
largeToolbar.setBorder(new MatteBorder(new Insets(0, 0, 1, 0), UIConstants.LINE_COLOR)); largeToolbar.setBorder(new MatteBorder(new Insets(0, 0, 1, 0), UIConstants.LINE_COLOR));
return largeToolbar; return largeToolbar;
} }
@ -352,7 +350,7 @@ public class Designer extends BaseDesigner {
* *
* @return 面板组件 * @return 面板组件
*/ */
public Component createAlphafinePane() { public Component createAlphaFinePane() {
return AlphaFinePane.getAlphaFinePane(); 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; package com.fr.design.actions.help.alphafine;
import com.fr.base.FRContext;
import com.fr.base.FRCoreContext; import com.fr.base.FRCoreContext;
import com.fr.general.VT4FR; import com.fr.general.VT4FR;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
@ -15,79 +16,68 @@ import javax.swing.*;
*/ */
public class AlphaFineConfigManager implements XMLable { public class AlphaFineConfigManager implements XMLable {
private static AlphaFineConfigManager alphaFineConfigManager = new AlphaFineConfigManager();
/** /**
* 是否开启alphafine * 是否开启alphafine
*/ */
private boolean isEnabled = true; private boolean isEnabled = true;
/** /**
* 是否联网搜索 * 是否联网搜索
*/ */
private boolean isSearchOnLine = true; private boolean isSearchOnLine = true;
/** /**
* 快捷键设置 * 搜索范围
*/ */
private String shortcuts;
/** /**
* 搜索范围 * 快捷键设置
*/ */
private String shortcuts;
/** /**
* 猜您需要 * 猜您需要
*/ */
private boolean isContainRecommend = true; private boolean isContainRecommend = true;
/** /**
* 设置 * 设置
*/ */
private boolean isContainAction = true; private boolean isContainAction = true;
/** /**
* 帮助文档 * 帮助文档
*/ */
private boolean isContainDocument = true; private boolean isContainDocument = true;
/** /**
* 模板 * 模板
*/ */
private boolean isContainTemplate = true; private boolean isContainTemplate = true;
/** /**
* 模板内容 * 模板内容
*/ */
private boolean isContainFileContent; private boolean isContainFileContent;
/** /**
* 应用中心 * 应用中心
*/ */
private boolean isContainPlugin = true; private boolean isContainPlugin = true;
/** /**
* 快捷键 * 快捷键
*/ */
private KeyStroke shortCutKeyStore; private KeyStroke shortCutKeyStore;
/** /**
* 是否提醒 * 是否提醒
*/ */
private boolean isNeedRemind = true; private boolean isNeedRemind = true;
/** /**
* 直接操作菜单次数 * 直接操作菜单次数
*/ */
private int operateCount; private int operateCount;
private static AlphaFineConfigManager alphaFineConfigManager = new AlphaFineConfigManager();
public static AlphaFineConfigManager getInstance() { public static AlphaFineConfigManager getInstance() {
return alphaFineConfigManager; return alphaFineConfigManager;
} }
public static boolean isALPHALicAvailable() {
return FRContext.getCurrentEnv() != null && VT4FR.isLicAvailable(FRCoreContext.getBytes()) && VT4FR.ALPHA_FINE.support();
}
@Override @Override
public Object clone() throws CloneNotSupportedException { public Object clone() throws CloneNotSupportedException {
AlphaFineConfigManager manager = (AlphaFineConfigManager) super.clone(); AlphaFineConfigManager manager = (AlphaFineConfigManager) super.clone();
@ -130,8 +120,6 @@ public class AlphaFineConfigManager implements XMLable {
writer.end(); writer.end();
} }
public boolean isSearchOnLine() { public boolean isSearchOnLine() {
return isSearchOnLine; return isSearchOnLine;
} }
@ -147,20 +135,20 @@ public class AlphaFineConfigManager implements XMLable {
return shortcuts; return shortcuts;
} }
public void setShortcuts(String shortcuts) {
this.shortcuts = shortcuts;
this.shortCutKeyStore = convert2KeyStroke(this.shortcuts);
}
/** /**
* 返回默认快捷键 * 返回默认快捷键
*
* @return * @return
*/ */
private String getDefaultShortCuts() { 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() { public boolean isContainAction() {
return 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.base.TableData;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.data.core.DataCoreXmlUtils; 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.EmbeddedTableData;
import com.fr.data.impl.storeproc.ProcedureDataModel; import com.fr.data.impl.storeproc.ProcedureDataModel;
import com.fr.data.impl.storeproc.StoreProcedure; import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.data.impl.storeproc.StoreProcedureConstants; import com.fr.data.impl.storeproc.StoreProcedureConstants;
import com.fr.design.data.tabledata.wrapper.*;
import com.fr.design.DesignModelAdapter; 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.file.HistoryTemplateListPane;
import com.fr.design.gui.iprogressbar.AutoProgressBar; import com.fr.design.gui.iprogressbar.AutoProgressBar;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.parameter.ParameterInputPane; import com.fr.design.parameter.ParameterInputPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.file.DatasourceManager; import com.fr.file.DatasourceManager;
import com.fr.file.DatasourceManagerProvider; import com.fr.file.DatasourceManagerProvider;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -34,8 +39,16 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.text.Collator; 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.Map.Entry;
import java.util.Timer;
import java.util.TimerTask;
/** /**
* 设计器管理操作数据集的类: * 设计器管理操作数据集的类:
@ -351,7 +364,20 @@ public abstract class DesignTableDataManager {
* @throws Exception 异常 * @throws Exception 异常
*/ */
public static EmbeddedTableData previewTableDataNeedInputParameters(TableData tabledata, int rowCount, boolean needLoadingBar) 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 异常 * @throws Exception 异常
*/ */
public static EmbeddedTableData previewTableDataNotNeedInputParameters(TableData tabledata, int rowCount, boolean needLoadingBar) 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 * @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(); final AutoProgressBar loadingBar = PreviewTablePane.getInstance().getProgressBar();
Env currentEnv = FRContext.getCurrentEnv(); Env currentEnv = FRContext.getCurrentEnv();
ParameterProvider[] parameters = currentEnv.getTableDataParameters(tabledata); ParameterProvider[] parameters = currentEnv.getTableDataParameters(tabledata);
@ -406,7 +445,7 @@ public abstract class DesignTableDataManager {
parameter.setValue(parameterMap.get(parameter.getName())); parameter.setValue(parameterMap.get(parameter.getName()));
} }
} }
return currentEnv.previewTableData(tabledata, parameterMap, rowCount); return currentEnv.previewTableData(tableDataSource, tabledata, parameterMap, rowCount);
} catch (TableDataException e) { } catch (TableDataException e) {
throw new TableDataException(e.getMessage(), e); throw new TableDataException(e.getMessage(), e);
} finally { } finally {

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

@ -1,6 +1,8 @@
package com.fr.design.data.datapane.connect; package com.fr.design.data.datapane.connect;
import com.fr.base.BaseUtils; 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.design.constants.UIConstants;
import com.fr.data.core.db.TableProcedure; import com.fr.data.core.db.TableProcedure;
import com.fr.design.border.UIRoundedBorder; import com.fr.design.border.UIRoundedBorder;
@ -20,6 +22,7 @@ import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
import java.util.List;
/** /**
* 数据集编辑面板左边的部分 * 数据集编辑面板左边的部分
@ -39,6 +42,12 @@ public class ConnectionTableProcedurePane extends BasicPane {
public ConnectionTableProcedurePane() { public ConnectionTableProcedurePane() {
this.setLayout(new BorderLayout(4, 4)); this.setLayout(new BorderLayout(4, 4));
connectionComboBox = new ConnectionComboBoxPanel(com.fr.data.impl.Connection.class) { 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() { protected void refreshItems() {
super.refreshItems(); super.refreshItems();
if (tableViewList != null) { if (tableViewList != null) {
@ -83,6 +92,10 @@ public class ConnectionTableProcedurePane extends BasicPane {
this.setPreferredSize(new Dimension(WIDTH, getPreferredSize().height)); 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() { protected JPanel createCheckBoxgroupPane() {
JPanel checkBoxgroupPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(2); JPanel checkBoxgroupPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(2);
JPanel first = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); 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.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.data.TableDataSource;
import com.fr.data.impl.DBTableData; import com.fr.data.impl.DBTableData;
import com.fr.data.impl.EmbeddedTableData; import com.fr.data.impl.EmbeddedTableData;
import com.fr.data.impl.storeproc.ProcedureDataModel; 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.data.DesignTableDataManager;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.iprogressbar.AutoProgressBar; import com.fr.design.gui.iprogressbar.AutoProgressBar;
@ -362,7 +364,8 @@ public class PreviewTablePane extends BasicPane {
} }
} }
connectionBar.close(); 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 // parameterInputDialog
// update之后的parameters,转成一个parameterMap,用于预览TableData // update之后的parameters,转成一个parameterMap,用于预览TableData
PreviewTableModel previewModel = new PreviewTableModel(previewTableData.createDataModel(null), (int) maxPreviewNumberField.getValue()); 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.Parameter;
import com.fr.base.ParameterHelper; import com.fr.base.ParameterHelper;
import com.fr.data.core.db.TableProcedure; 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.DBTableData;
import com.fr.data.impl.JDBCDatabaseConnection;
import com.fr.data.impl.JNDIDatabaseConnection;
import com.fr.data.impl.NameDatabaseConnection; import com.fr.data.impl.NameDatabaseConnection;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
@ -37,6 +41,7 @@ import com.fr.script.Calculator;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.ParameterProvider; import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import org.sqlite.JDBC;
import javax.swing.*; import javax.swing.*;
import javax.swing.text.BadLocationException; import javax.swing.text.BadLocationException;
@ -102,7 +107,12 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
sqlSplitPane.add(box, BorderLayout.CENTER); sqlSplitPane.add(box, BorderLayout.CENTER);
// 左边的Panel,上面是选择DatabaseConnection的ComboBox,下面DatabaseConnection对应的Table // 左边的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() { connectionTableProcedurePane.addDoubleClickListener(new DoubleClickSelectedNodeOnTreeListener() {
@Override @Override
@ -138,6 +148,7 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
this.add(mainSplitPane, BorderLayout.CENTER); this.add(mainSplitPane, BorderLayout.CENTER);
} }
private boolean isPreviewOrRefreshButton (FocusEvent e) { private boolean isPreviewOrRefreshButton (FocusEvent e) {
if (e.getOppositeComponent() != null) { if (e.getOppositeComponent() != null) {
String name = e.getOppositeComponent().getName(); 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; EmbeddedTableData embeddedTableData = null;
try { try {
embeddedTableData = DesignTableDataManager.previewTableDataNotNeedInputParameters(tabledata, TableData.RESULT_NOT_NEED, false); embeddedTableData = DesignTableDataManager.previewTableDataNotNeedInputParameters(tds, tabledata, TableData.RESULT_NOT_NEED, false);
} catch (Exception e) { } catch (Exception e) {
if (e.getMessage()!=null) { if (e.getMessage()!=null) {
DesignUtils.errorMessage(e.getMessage()); DesignUtils.errorMessage(e.getMessage());

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

@ -1,16 +1,16 @@
package com.fr.design.designer; package com.fr.design.designer;
import javax.swing.*; import com.fr.design.DesignState;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import com.fr.design.mainframe.AuthorityEditPane;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.DesignState;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.stable.StringUtils; 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 abstract void stopEditing();
public final T getTarget() { public T getTarget() {
return target; 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; private CellBorderStyle border = null;
protected UIObserverListener uiObserverListener; protected UIObserverListener uiObserverListener;
private static final int TOOLTIP_INIT_DELAY = 1000; // 延迟 1s 显示提示文字 private static final int TOOLTIP_INIT_DELAY = 300; // 延迟 0.3s 显示提示文字
public UIButton() { public UIButton() {
this(StringUtils.EMPTY); 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) { public UIHeadGroup(String[] textArray) {
labelButtonList = new ArrayList<UIToggleButton>(textArray.length); labelButtonList = new ArrayList<UIToggleButton>(textArray.length);
this.setBackground(UIConstants.NORMAL_BACKGROUND); this.setBackground(UIConstants.TREE_BACKGROUND);
this.setLayout(new GridLayout(0, textArray.length, 1, 0)); this.setLayout(new GridLayout(0, textArray.length, 0, 0));
// this.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1)); // this.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
for (int i = 0; i < textArray.length; i++) { for (int i = 0; i < textArray.length; i++) {
final int index = i; final int index = i;

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) { public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
cellHasFocus = cellHasFocus && !this.isEnabled(); cellHasFocus = cellHasFocus && !this.isEnabled();
JLabel renderer =(JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); JLabel renderer =(JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
renderer.setForeground(Color.black); renderer.setOpaque(true);
list.setSelectionBackground(UIConstants.COMBOBOX_BTN_PRESS); list.setSelectionBackground(UIConstants.NORMAL_BLUE);
list.setSelectionForeground(Color.black); 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()); renderer.setText(" " + renderer.getText());
return renderer; return renderer;
} }

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

@ -65,7 +65,6 @@ public class NullTristateCheckBox extends TristateCheckBox {
// @Override // @Override
public void updateUI() { public void updateUI() {
super.updateUI();
clearAttribute(); 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

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

File diff suppressed because it is too large Load Diff

213
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.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.FRCoreContext;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.community.*; import com.fr.design.actions.community.BBSAction;
import com.fr.design.actions.file.*; 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.AboutAction;
import com.fr.design.actions.help.TutorialAction; import com.fr.design.actions.help.TutorialAction;
import com.fr.design.actions.help.WebDemoAction; import com.fr.design.actions.help.WebDemoAction;
import com.fr.design.actions.help.alphafine.AlphaFineAction; 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.file.NewTemplatePane;
import com.fr.design.fun.MenuHandler; import com.fr.design.fun.MenuHandler;
import com.fr.design.fun.TableDataPaneProcessor; import com.fr.design.fun.TableDataPaneProcessor;
@ -35,7 +51,6 @@ import com.fr.env.RemoteEnv;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.VT4FR;
import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginRuntime; import com.fr.plugin.context.PluginRuntime;
import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.manage.PluginFilter;
@ -48,8 +63,11 @@ import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.util.*; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Set;
/** /**
* @author richer * @author richer
@ -61,12 +79,63 @@ import java.util.List;
* 还有docking的状态的保存,下次打开设计器,也应该是这样的 * 还有docking的状态的保存,下次打开设计器,也应该是这样的
*/ */
public abstract class ToolBarMenuDock { 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 String FINEREPORT = "FineReport";
private static final int MENUBAR_HEIGHT = 22; private static final int MENUBAR_HEIGHT = 22;
public static final int PANLE_HEIGNT = 26;
private MenuDef[] menus; private MenuDef[] menus;
private ToolBarDef toolBarDef; private ToolBarDef toolBarDef;
private List<UpdateActionModel> shortCutsList; private List<UpdateActionModel> shortCutsList;
/** /**
* 更新菜单 * 更新菜单
*/ */
@ -118,6 +187,10 @@ public abstract class ToolBarMenuDock {
return jMenuBar; return jMenuBar;
} }
//////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////menu below/////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
/** /**
* 生成报表设计和表单设计的编辑区域 * 生成报表设计和表单设计的编辑区域
* *
@ -127,10 +200,6 @@ public abstract class ToolBarMenuDock {
return null; return null;
} }
//////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////menu below/////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
public MenuDef[] menus(final ToolBarMenuDockPlus plus) { public MenuDef[] menus(final ToolBarMenuDockPlus plus) {
java.util.List<MenuDef> menuList = new java.util.ArrayList<MenuDef>(); java.util.List<MenuDef> menuList = new java.util.ArrayList<MenuDef>();
// 添加文件菜单 // 添加文件菜单
@ -164,6 +233,7 @@ public abstract class ToolBarMenuDock {
/** /**
* 获取所有actionmodel * 获取所有actionmodel
*
* @param menuList * @param menuList
*/ */
private void addAllUpdateActionsToList(List<MenuDef> menuList) { private void addAllUpdateActionsToList(List<MenuDef> menuList) {
@ -175,6 +245,7 @@ public abstract class ToolBarMenuDock {
/** /**
* 递归获取所有UpdateAction * 递归获取所有UpdateAction
*
* @param menuDef * @param menuDef
*/ */
private void addUpdateActionToList(MenuDef menuDef, int level) { 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 locale = FRContext.getLocale();
Locale [] locales =supportCommunityLocales(); Locale[] locales = supportCommunityLocales();
for(int i = 0; i < locales.length; i++) { for (int i = 0; i < locales.length; i++) {
if(locale.equals(locales[i])){ if (locale.equals(locales[i])) {
menuList.add(createCommunityMenuDef()); menuList.add(createCommunityMenuDef());
break; break;
} }
@ -218,13 +289,13 @@ public abstract class ToolBarMenuDock {
// 给菜单加插件入口 // 给菜单加插件入口
for (MenuDef m : menuDefs) { for (MenuDef m : menuDefs) {
switch (m.getAnchor()) { switch (m.getAnchor()) {
case MenuHandler.TEMPLATE : case MenuHandler.TEMPLATE:
insertMenu(m, MenuHandler.TEMPLATE, new TemplateTargetAction(plus)); insertMenu(m, MenuHandler.TEMPLATE, new TemplateTargetAction(plus));
break; break;
case MenuHandler.INSERT : case MenuHandler.INSERT:
insertMenu(m, MenuHandler.INSERT); insertMenu(m, MenuHandler.INSERT);
break; break;
case MenuHandler.CELL : case MenuHandler.CELL:
insertMenu(m, MenuHandler.CELL); insertMenu(m, MenuHandler.CELL);
break; break;
default: default:
@ -271,7 +342,7 @@ public abstract class ToolBarMenuDock {
addSwitchExistEnvAction(menuDef); addSwitchExistEnvAction(menuDef);
menuDef.addShortCut( new ExitDesignerAction()); menuDef.addShortCut(new ExitDesignerAction());
insertMenu(menuDef, MenuHandler.FILE); insertMenu(menuDef, MenuHandler.FILE);
return menuDef; return menuDef;
@ -293,7 +364,7 @@ public abstract class ToolBarMenuDock {
menuDef.addShortCut(new SwitchExistEnv()); menuDef.addShortCut(new SwitchExistEnv());
} }
protected ShortCut openTemplateAction(){ protected ShortCut openTemplateAction() {
return new OpenTemplateAction(); return new OpenTemplateAction();
} }
@ -308,17 +379,15 @@ public abstract class ToolBarMenuDock {
* 创建论坛登录面板, chart那边不需要 * 创建论坛登录面板, chart那边不需要
* *
* @return 面板组件 * @return 面板组件
*
*/ */
public Component createBBSLoginPane(){ public Component createBBSLoginPane() {
return new UILabel(); return new UILabel();
} }
public Component createAlphafinePane(){ public Component createAlphaFinePane() {
return new UILabel(); return new UILabel();
} }
protected MenuDef createServerMenuDef(ToolBarMenuDockPlus plus) { protected MenuDef createServerMenuDef(ToolBarMenuDockPlus plus) {
MenuDef menuDef = new MenuDef(Inter.getLocText("FR-Designer_M-Server"), 'S'); MenuDef menuDef = new MenuDef(Inter.getLocText("FR-Designer_M-Server"), 'S');
@ -361,6 +430,7 @@ public abstract class ToolBarMenuDock {
/** /**
* 创建帮助子菜单 * 创建帮助子菜单
*
* @return 帮组菜单的子菜单 * @return 帮组菜单的子菜单
*/ */
public ShortCut[] createHelpShortCuts() { public ShortCut[] createHelpShortCuts() {
@ -372,25 +442,22 @@ public abstract class ToolBarMenuDock {
shortCuts.add(new TutorialAction()); shortCuts.add(new TutorialAction());
} }
shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(SeparatorDef.DEFAULT);
//shortCuts.add(new TutorialAction());
shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(SeparatorDef.DEFAULT);
if (ComparatorUtils.equals(ProductConstants.APP_NAME,FINEREPORT)) { if (ComparatorUtils.equals(ProductConstants.APP_NAME, FINEREPORT)) {
// mod by anchore 16/11/17 去掉反馈
//shortCuts.add(new FeedBackAction());
shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(SeparatorDef.DEFAULT);
}
if (AlphaFineConfigManager.isALPHALicAvailable()) {
shortCuts.add(new AlphaFineAction());
shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(SeparatorDef.DEFAULT);
// shortCuts.add(new ForumAction());
} }
shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(SeparatorDef.DEFAULT);
shortCuts.add(new AlphaFineAction());
shortCuts.add(SeparatorDef.DEFAULT);
shortCuts.add(new AboutAction()); shortCuts.add(new AboutAction());
return shortCuts.toArray(new ShortCut[shortCuts.size()]); return shortCuts.toArray(new ShortCut[shortCuts.size()]);
} }
/** /**
* 创建社区子菜单 * 创建社区子菜单
*
* @return 社区菜单的子菜单 * @return 社区菜单的子菜单
*/ */
public ShortCut[] createCommunityShortCuts() { public ShortCut[] createCommunityShortCuts() {
@ -405,6 +472,7 @@ public abstract class ToolBarMenuDock {
shortCuts.add(new SignAction()); shortCuts.add(new SignAction());
return shortCuts.toArray(new ShortCut[shortCuts.size()]); return shortCuts.toArray(new ShortCut[shortCuts.size()]);
} }
public MenuDef createHelpMenuDef() { public MenuDef createHelpMenuDef() {
MenuDef menuDef = new MenuDef(Inter.getLocText("FR-Designer_Help"), 'H'); MenuDef menuDef = new MenuDef(Inter.getLocText("FR-Designer_Help"), 'H');
ShortCut[] otherHelpShortCuts = createHelpShortCuts(); ShortCut[] otherHelpShortCuts = createHelpShortCuts();
@ -414,6 +482,7 @@ public abstract class ToolBarMenuDock {
insertMenu(menuDef, MenuHandler.HELP); insertMenu(menuDef, MenuHandler.HELP);
return menuDef; return menuDef;
} }
public MenuDef createCommunityMenuDef() { public MenuDef createCommunityMenuDef() {
MenuDef menuDef = new MenuDef(Inter.getLocText("FR-Designer_COMMUNITY"), 'C'); MenuDef menuDef = new MenuDef(Inter.getLocText("FR-Designer_COMMUNITY"), 'C');
ShortCut[] otherCommunityShortCuts = createCommunityShortCuts(); ShortCut[] otherCommunityShortCuts = createCommunityShortCuts();
@ -423,6 +492,7 @@ public abstract class ToolBarMenuDock {
insertMenu(menuDef, MenuHandler.BBS); insertMenu(menuDef, MenuHandler.BBS);
return menuDef; return menuDef;
} }
/** /**
* 生成工具栏 * 生成工具栏
* *
@ -460,7 +530,6 @@ public abstract class ToolBarMenuDock {
} }
} }
protected JPanel polyToolBar(String text) { protected JPanel polyToolBar(String text) {
JPanel panel = new JPanel(new BorderLayout()) { JPanel panel = new JPanel(new BorderLayout()) {
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
@ -477,7 +546,6 @@ public abstract class ToolBarMenuDock {
return panel; return panel;
} }
/** /**
* 重置上面的工具栏 * 重置上面的工具栏
* *
@ -488,7 +556,6 @@ public abstract class ToolBarMenuDock {
return plus.toolBarButton4Form(); return plus.toolBarButton4Form();
} }
/** /**
* 创建大的工具按钮 * 创建大的工具按钮
* *
@ -507,62 +574,11 @@ public abstract class ToolBarMenuDock {
return new UIButton[0]; return new UIButton[0];
} }
protected void refreshLargeToolbarState() { protected void refreshLargeToolbarState() {
} }
public static final ToolBarMenuDockPlus NULLAVOID = new ToolBarMenuDockPlus() { public NewTemplatePane getNewTemplatePane() {
@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(){
return new NewTemplatePane() { return new NewTemplatePane() {
@Override @Override
public Icon getNew() { public Icon getNew() {
@ -641,7 +657,7 @@ public abstract class ToolBarMenuDock {
return; return;
} }
ShortCut shortCut = action.methodAction(handler); ShortCut shortCut = action.methodAction(handler);
if (shortCut == null){ if (shortCut == null) {
continue; continue;
} }
menuDef.removeShortCut(shortCut); menuDef.removeShortCut(shortCut);
@ -663,7 +679,7 @@ public abstract class ToolBarMenuDock {
return; return;
} }
ShortCut shortCut = action.methodAction(handler); ShortCut shortCut = action.methodAction(handler);
if (shortCut == null){ if (shortCut == null) {
continue; continue;
} }
@ -676,10 +692,10 @@ public abstract class ToolBarMenuDock {
menuDef.insertShortCut(insertPosition, shortCut); menuDef.insertShortCut(insertPosition, shortCut);
if (handler.insertSeparatorBefore()) { if (handler.insertSeparatorBefore()) {
menuDef.insertShortCut(insertPosition, SeparatorDef.DEFAULT); menuDef.insertShortCut(insertPosition, SeparatorDef.DEFAULT);
insertPosition ++; insertPosition++;
} }
if (handler.insertSeparatorAfter()) { if (handler.insertSeparatorAfter()) {
insertPosition ++; insertPosition++;
menuDef.insertShortCut(insertPosition, SeparatorDef.DEFAULT); menuDef.insertShortCut(insertPosition, SeparatorDef.DEFAULT);
} }
} }
@ -688,36 +704,35 @@ public abstract class ToolBarMenuDock {
/** /**
* 设计器退出时, 做的一些操作. * 设计器退出时, 做的一些操作.
*
*/ */
public void shutDown(){ public void shutDown() {
} }
private interface ShortCutMethodAction{ private interface ShortCutMethodAction {
public ShortCut methodAction(MenuHandler handler); 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(); return handler.shortcut();
} }
} }
//不需要编辑对象的菜单, 比如文件, 服务器, 关于 //不需要编辑对象的菜单, 比如文件, 服务器, 关于
private class NoTargetAction extends AbstractShortCutMethodAction{ private class NoTargetAction extends AbstractShortCutMethodAction {
} }
//模板为对象的菜单, 比如模板, 后续如果单元格也要, 直接加个CellTargetAction即可. //模板为对象的菜单, 比如模板, 后续如果单元格也要, 直接加个CellTargetAction即可.
//在methodAction中做handler.shortcut(cell), 不需要修改handler中原有接口, 加个shortcut(cell). //在methodAction中做handler.shortcut(cell), 不需要修改handler中原有接口, 加个shortcut(cell).
private class TemplateTargetAction extends AbstractShortCutMethodAction{ private class TemplateTargetAction extends AbstractShortCutMethodAction {
private ToolBarMenuDockPlus plus; private ToolBarMenuDockPlus plus;
public TemplateTargetAction(ToolBarMenuDockPlus plus){ public TemplateTargetAction(ToolBarMenuDockPlus plus) {
this.plus = 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; package com.fr.design.mainframe.toolbar;
import com.fr.design.actions.UpdateAction;
import com.fr.general.ComparatorUtils;
import java.util.List; import java.util.List;
/** /**
@ -23,4 +26,13 @@ public class UpdateActionManager {
public void setUpdateActions(List<UpdateActionModel> updateActions) { public void setUpdateActions(List<UpdateActionModel> updateActions) {
this.updateActions = 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.design.layout.TableLayoutHelper;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*; import javax.swing.BorderFactory;
import java.awt.*; import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
/** /**
* Created by plough on 2017/8/7. * Created by plough on 2017/8/7.
@ -25,7 +27,7 @@ public class BasicPropertyPane extends BasicPane {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
widgetName = new UITextField(); widgetName = new UITextField();
widgetName.setGlobalName(Inter.getLocText("FR-Designer_Widget_Name"));
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p}; 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; 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.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.ArrayList; import java.util.ArrayList;
import javax.swing.AbstractButton;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.plaf.ButtonUI;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.Exception.ValidationException; import com.fr.design.Exception.ValidationException;
import com.fr.design.gui.ibutton.UIButtonUI;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.widget.editors.ITextComponent; import com.fr.design.mainframe.widget.editors.ITextComponent;
import com.fr.design.mainframe.widget.editors.TextField; import com.fr.design.mainframe.widget.editors.TextField;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.designer.properties.Decoder; import com.fr.design.designer.properties.Decoder;
import com.fr.design.designer.properties.Encoder; import com.fr.design.designer.properties.Encoder;
import com.fr.design.utils.gui.GUIPaintUtils;
/** /**
* @since 6.5.3 * @since 6.5.3
@ -77,7 +83,28 @@ public class BaseAccessibleEditor extends BasicPane implements AccessibleEditor
setOpaque(false); setOpaque(false);
if (showButton) { 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(); initPopupButton();
btPopup.addActionListener(new ActionListener() { btPopup.addActionListener(new ActionListener() {
@ -189,4 +216,6 @@ public class BaseAccessibleEditor extends BasicPane implements AccessibleEditor
public static void showMessage(String message, Component editorComponent) { public static void showMessage(String message, Component editorComponent) {
JOptionPane.showMessageDialog(editorComponent, message, "Validation Error", JOptionPane.ERROR_MESSAGE); 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 com.fr.design.data.DataCreatorUI;
import javax.swing.*; import javax.swing.JComponent;
public interface DataModify<T> { public interface DataModify<T> {
@ -15,4 +16,9 @@ public interface DataModify<T> {
DataCreatorUI dataUI(); DataCreatorUI dataUI();
JComponent toSwingComponent(); 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; 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.base.remote.RemoteDeziConstants;
import com.fr.data.TableDataSource;
import com.fr.data.core.DataCoreUtils; import com.fr.data.core.DataCoreUtils;
import com.fr.data.core.db.TableProcedure; import com.fr.data.core.db.TableProcedure;
import com.fr.data.impl.Connection; import com.fr.data.impl.Connection;
@ -21,13 +30,25 @@ import com.fr.file.CacheManager;
import com.fr.file.DatasourceManager; import com.fr.file.DatasourceManager;
import com.fr.file.DatasourceManagerProvider; import com.fr.file.DatasourceManagerProvider;
import com.fr.file.filetree.FileNode; 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.general.http.HttpClient;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
import com.fr.json.JSONException; import com.fr.json.JSONException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.share.ShareConstants; 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.file.XMLFileManagerProvider;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.stable.xml.XMLPrintWriter; 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.stable.xml.XMLableReader;
import com.fr.web.ResourceConstants; import com.fr.web.ResourceConstants;
import javax.swing.*; import javax.swing.JOptionPane;
import javax.xml.transform.*; 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.dom.DOMSource;
import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamResult;
import java.awt.*; import java.awt.Component;
import java.io.*; 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.HttpURLConnection;
import java.net.NoRouteToHostException; import java.net.NoRouteToHostException;
import java.net.Socket; 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.List;
import java.util.Map;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -112,6 +155,15 @@ public class RemoteEnv extends AbstractEnv {
return password; return password;
} }
// 修复密码中包含特殊字符,无法登录的问题
private String getEncodedPassword() {
try {
return URLEncoder.encode(password, "UTF-8");
} catch (UnsupportedEncodingException e) {
return password;
}
}
public void setPassword(String password) { public void setPassword(String password) {
this.password = password; this.password = password;
clearUserID(); clearUserID();
@ -175,12 +227,8 @@ public class RemoteEnv extends AbstractEnv {
* 根据nameValuePairs,也就是参数对,生成PostMethod,不同之处在于,参数拼在path后面,不是method.addParameters * 根据nameValuePairs,也就是参数对,生成PostMethod,不同之处在于,参数拼在path后面,不是method.addParameters
*/ */
private HttpClient createHttpMethod2(HashMap<String, String> para) throws EnvException { private HttpClient createHttpMethod2(HashMap<String, String> para) throws EnvException {
StringBuilder sb = new StringBuilder(path); String methodPath = path + '?' + "id=" + createUserID();
return new HttpClient(methodPath, para, true);
sb.append('?');
sb.append("id=").append(createUserID());
return new HttpClient(sb.toString(), para, true);
} }
@ -337,7 +385,7 @@ public class RemoteEnv extends AbstractEnv {
para.put("op", "fr_remote_design"); para.put("op", "fr_remote_design");
para.put("cmd", "test_server_connection"); para.put("cmd", "test_server_connection");
para.put("user", user); para.put("user", user);
para.put("password", password); para.put("password", getEncodedPassword());
if (path.startsWith("https") && (!DesignerEnvManager.getEnvManager().isHttps())) { if (path.startsWith("https") && (!DesignerEnvManager.getEnvManager().isHttps())) {
return false; 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(new String[]{"Datasource-Connection_failed", "Registration-User_Name", "Password", "Error"}, new String[]{",", "", "", "!"})
, Inter.getLocText("FR-Server-All_Error"), JOptionPane.ERROR_MESSAGE); , Inter.getLocText("FR-Server-All_Error"), JOptionPane.ERROR_MESSAGE);
return false; return false;
} else if (res.indexOf("RegistEditionException") != -1) { } else if (res.contains("RegistEditionException")) {
if (needMessage) { if (needMessage) {
JOptionPane.showMessageDialog(parentComponent, Inter.getLocText(new String[]{"Datasource-Connection_failed", "Version-does-not-support"}, new String[]{",", "!"})); JOptionPane.showMessageDialog(parentComponent, Inter.getLocText(new String[]{"Datasource-Connection_failed", "Version-does-not-support"}, new String[]{",", "!"}));
} else { } else {
@ -415,9 +463,8 @@ public class RemoteEnv extends AbstractEnv {
para.put("op", "fr_remote_design"); para.put("op", "fr_remote_design");
para.put("cmd", "heart_beat"); para.put("cmd", "heart_beat");
para.put("user", user); para.put("user", user);
para.put("userid", userID);
HttpClient client = createHttpMethod(para, true); HttpClient client = createHttpMethod(para);
execute4InputStream(client); execute4InputStream(client);
//这做法不好, 30秒刷一次, 刷新的时候会重新构建树, 构建完会把子节点都收缩起来, 效果太差. //这做法不好, 30秒刷一次, 刷新的时候会重新构建树, 构建完会把子节点都收缩起来, 效果太差.
@ -459,7 +506,7 @@ public class RemoteEnv extends AbstractEnv {
para.put("op", "fr_remote_design"); para.put("op", "fr_remote_design");
para.put("cmd", "r_sign_in"); para.put("cmd", "r_sign_in");
para.put("user", user); para.put("user", user);
para.put("password", password); para.put("password", getEncodedPassword());
simulaRPC(para, true); simulaRPC(para, true);
@ -552,7 +599,7 @@ public class RemoteEnv extends AbstractEnv {
if (resJSON == null) { if (resJSON == null) {
return false; return false;
} }
if (resJSON.indexOf("RegistEditionException") != -1) { if (resJSON.contains("RegistEditionException")) {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Lic_does_not_Support_Remote")); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Lic_does_not_Support_Remote"));
return false; return false;
} }
@ -1207,6 +1254,11 @@ public class RemoteEnv extends AbstractEnv {
return DavXMLUtils.readXMLParameters(input); 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 实际的二维数据集 * @return 实际的二维数据集
* @throws Exception 如果生成数据失败则抛出此异常 * @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(); ByteArrayOutputStream out = new ByteArrayOutputStream();
// 把tableData写成xml文件到out // 把tableData写成xml文件到out
@ -1255,6 +1307,11 @@ public class RemoteEnv extends AbstractEnv {
return previewTableData(tableData, parameterMap, -1); 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是无法得到的 * nameValuePairs,这个参数要接着this.path,拼成一个URL,否则服务器端req.getParameter是无法得到的
* *
@ -1939,7 +1996,7 @@ public class RemoteEnv extends AbstractEnv {
para.put("op", "fr_remote_design"); para.put("op", "fr_remote_design");
para.put("cmd", "design_get_designer_version"); para.put("cmd", "design_get_designer_version");
para.put("user", user); para.put("user", user);
para.put("password", password); para.put("password", getEncodedPassword());
HttpClient client = createHttpMethod(para, true); HttpClient client = createHttpMethod(para, true);
try { try {
@ -2161,6 +2218,10 @@ public class RemoteEnv extends AbstractEnv {
} }
} }
public void doWhenServerShutDown() {
}
@Override @Override
public boolean isLocalEnv() { 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.actions.PasteAction;
import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEditListener;
import com.fr.design.designer.beans.events.DesignerEvent; 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.designer.properties.FormWidgetAuthorityEditPane;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
@ -54,8 +59,17 @@ import com.fr.stable.ArrayUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
import javax.swing.*; import javax.swing.BorderFactory;
import java.awt.*; 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.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.image.BufferedImage; 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 @Override
protected FormModelAdapter createDesignModel() { protected FormModelAdapter createDesignModel() {
return new FormModelAdapter(this); 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.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.core.WidgetOption;
import com.fr.design.mainframe.FormWebWidgetConstants; import com.fr.design.mainframe.FormWebWidgetConstants;
import com.fr.design.mainframe.widget.editors.ElementCaseToolBarPane; 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.design.mainframe.widget.wrappers.ElementCaseToolBarWrapper;
import com.fr.form.web.FormToolBarManager; import com.fr.form.web.FormToolBarManager;
import com.fr.general.Inter;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import javax.swing.*; import javax.swing.SwingUtilities;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -54,4 +58,19 @@ public class AccessibleElementCaseToolBarEditor extends UneditableAccessibleEdit
options.addAll(defaultOptions); options.addAll(defaultOptions);
return options.toArray(new WidgetOption[options.size()]); 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.WScaleLayout;
import com.fr.form.ui.container.WTitleLayout; import com.fr.form.ui.container.WTitleLayout;
import com.fr.form.ui.widget.CRBoundsWidget; import com.fr.form.ui.widget.CRBoundsWidget;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.BorderFactory;
import java.awt.*; import javax.swing.JComponent;
import javax.swing.JPanel;
import java.awt.BorderLayout;
/** /**
* Created by ibm on 2017/7/25. * Created by ibm on 2017/7/25.
@ -199,13 +203,19 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
public void updateCreator() { public void updateCreator() {
currentEditorDefinePane.setGlobalName(getGlobalName());
Widget widget = currentEditorDefinePane.updateBean(); Widget widget = currentEditorDefinePane.updateBean();
widgetPropertyPane.update(widget); if(ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Widget_Name"))){
if (widgetBoundPane != null) { 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(); widgetBoundPane.update();
} }
xCreator.resetCreatorName(widget.getWidgetName());
designer.getEditListenerTable().fireCreatorModified(xCreator, DesignerEvent.CREATOR_RENAMED);
fireValueChanged(); 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.designer.creator.XCreator;
import com.fr.design.widget.DataModify; import com.fr.design.widget.DataModify;
import javax.swing.*; import javax.swing.JComponent;
/** /**
* Created by kerry on 17/07/28. * Created by kerry on 17/07/28.
*/ */
public abstract class AbstractDataModify<T> extends BasicBeanPane<T> implements DataModify<T> { public abstract class AbstractDataModify<T> extends BasicBeanPane<T> implements DataModify<T> {
protected XCreator creator; protected XCreator creator;
protected String globalName;
public AbstractDataModify(XCreator xCreator){ public AbstractDataModify(XCreator xCreator){
@ -28,5 +30,11 @@ public abstract class AbstractDataModify<T> extends BasicBeanPane<T> implements
return this; 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.ArrayUtils;
import com.fr.stable.UtilEvalError; 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.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.*; import java.awt.*;
@ -38,6 +40,7 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
private UIComboBox currentFormatComboBox; private UIComboBox currentFormatComboBox;
private UILabel currentSamplelabel; private UILabel currentSamplelabel;
private UIButtonGroup fomatHeadGroup; private UIButtonGroup fomatHeadGroup;
private static final int SAMPLE_LABEL_PADDING = 4;
public DateEditorDefinePane(XCreator xCreator) { public DateEditorDefinePane(XCreator xCreator) {
super(xCreator); super(xCreator);
@ -64,12 +67,12 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Label_Name")), labelNameTextField}, 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-Designer-Estate_Widget_Value")), formWidgetValuePane},
new Component[]{new UILabel(Inter.getLocText("FR-Engine_Format") + ":"), formatHead}, 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_Start_Date")), startDv},
new Component[]{new UILabel(Inter.getLocText("FS_End_Date") + ":"), endDv}, new Component[]{new UILabel(Inter.getLocText("FS_End_Date")), endDv},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_WaterMark") + ":"), waterMarkDictPane}, 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("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}; 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){ private JPanel createFormatPane(UIComboBox formatComboBox, UILabel sampleLabel){
JPanel previewPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Base_StyleFormat_Sample")); 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 jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
jPanel.add(previewPane, BorderLayout.NORTH); jPanel.add(previewPane, BorderLayout.NORTH);
jPanel.add(formatComboBox, BorderLayout.CENTER); jPanel.add(formatComboBox, BorderLayout.CENTER);
@ -93,7 +102,13 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
} }
private UILabel createSamplePane(){ 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.setHorizontalAlignment(SwingConstants.CENTER);
sampleLabel.setFont(FRContext.getDefaultValues().getFRFont()); sampleLabel.setFont(FRContext.getDefaultValues().getFRFont());
return sampleLabel; 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.form.ui.PaddingMargin;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*; import javax.swing.BorderFactory;
import java.awt.*; import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.Component;
/** /**
* Created by ibm on 2017/8/3. * Created by ibm on 2017/8/3.
*/ */
public class PaddingBoundPane extends BasicPane { public class PaddingBoundPane extends BasicPane{
protected UISpinner top; protected UISpinner top;
protected UISpinner bottom; protected UISpinner bottom;
protected UISpinner left; protected UISpinner left;
@ -33,6 +36,10 @@ public class PaddingBoundPane extends BasicPane {
bottom = new UISpinner(0, 1000, 1, 0); bottom = new UISpinner(0, 1000, 1, 0);
left = new UISpinner(0, 1000, 1, 0); left = new UISpinner(0, 1000, 1, 0);
right = 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 f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p}; 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); JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1);
panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 0)); panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 0));
this.add(panel); this.add(panel);
} }
public void update(AbstractMarginWidget marginWidget) { public void update(AbstractMarginWidget marginWidget) {
marginWidget.setMargin(new PaddingMargin((int)top.getValue(), (int)left.getValue(), (int)bottom.getValue(), (int)right.getValue() )); 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()); 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; package com.fr.design.widget.ui.designer.component;
import com.fr.design.designer.creator.XCreator; 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.gui.ispinner.UISpinner;
import com.fr.design.widget.WidgetBoundsPaneFactory; 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. * Created by ibm on 2017/8/3.
*/ */
public class WidgetAbsoluteBoundPane extends WidgetBoundPane { public class WidgetAbsoluteBoundPane extends WidgetBoundPane {
protected XWAbsoluteLayout parent;
private UISpinner x; private UISpinner x;
private UISpinner y; private UISpinner y;
public WidgetAbsoluteBoundPane(XCreator source){ public WidgetAbsoluteBoundPane(XCreator source){
super(source); super(source);
XLayoutContainer xLayoutContainer = getParent(source);
this.parent = (XWAbsoluteLayout) xLayoutContainer;
} }
public void initBoundPane() { public void initBoundPane() {
@ -28,6 +25,10 @@ public class WidgetAbsoluteBoundPane extends WidgetBoundPane {
y = new UISpinner(0, 1200, 1); y = new UISpinner(0, 1200, 1);
width = new UISpinner(0, 1200, 1); width = new UISpinner(0, 1200, 1);
height = 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)); this.add(WidgetBoundsPaneFactory.createAbsoluteBoundsPane(x, y, width, height));
} }
@ -40,13 +41,25 @@ public class WidgetAbsoluteBoundPane extends WidgetBoundPane {
if (parent == null) { if (parent == null) {
return; return;
} }
WAbsoluteLayout wabs = parent.toData(); WLayout wabs = parent.toData();
wabs.setBounds(creator.toData(), bounds); wabs.setBounds(creator.toData(), bounds);
creator.setBounds(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() { protected String title4PopupWindow() {
return ""; return "absoluteBound";
} }
public void populate() { 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; 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.*;
import com.fr.design.designer.creator.cardlayout.XWCardLayout;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.FRGUIPaneFactory; 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.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. * Created by ibm on 2017/7/30.
*/ */
public class WidgetBoundPane extends BasicPane { 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 XCreator creator;
protected UISpinner width; protected UISpinner width;
protected UISpinner height; protected UISpinner height;
@ -20,6 +35,7 @@ public class WidgetBoundPane extends BasicPane {
public WidgetBoundPane(XCreator source) { public WidgetBoundPane(XCreator source) {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.creator = source; this.creator = source;
this.parent = getParent(source);
initBoundPane(); initBoundPane();
} }
@ -34,19 +50,22 @@ public class WidgetBoundPane extends BasicPane {
public void initBoundPane() { public void initBoundPane() {
width = new UISpinner(0, 1200, 1); width = new UISpinner(0, 1200, 1);
height = 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)); this.add(WidgetBoundsPaneFactory.createBoundsPane(width, height));
} }
public void update() { public void update() {
Rectangle bounds = new Rectangle(creator.getBounds()); fix();
bounds.width = (int) width.getValue();
bounds.height = (int) height.getValue();
creator.setBounds(bounds);
} }
protected String title4PopupWindow() { protected String title4PopupWindow() {
return ""; return "widgetBound";
} }
public void populate() { public void populate() {
@ -54,4 +73,88 @@ public class WidgetBoundPane extends BasicPane {
width.setValue(bounds.width); width.setValue(bounds.width);
height.setValue(bounds.height); 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.design.widget.ui.designer.component.PaddingBoundPane;
import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.web.FormToolBarManager; import com.fr.form.web.FormToolBarManager;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*; import javax.swing.BorderFactory;
import java.awt.*; import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
/** /**
* Created by ibm on 2017/8/7. * Created by ibm on 2017/8/7.
@ -45,8 +48,13 @@ public class ElementEditorDefinePane extends WTitleLayoutDefinePane<ElementCaseE
protected ElementCaseEditor updateSubBean() { protected ElementCaseEditor updateSubBean() {
ElementCaseEditor elementCaseEditor = (ElementCaseEditor) creator.toData(); ElementCaseEditor elementCaseEditor = (ElementCaseEditor) creator.toData();
paddingBoundPane.update(elementCaseEditor); if(ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Layout-Padding"))){
elementCaseEditor.setToolBars((FormToolBarManager[]) elementCaseToolBarEditor.getValue()); paddingBoundPane.update(elementCaseEditor);
}
if(ComparatorUtils.equals(getGlobalName(), Inter.getLocText("Form-EC_toolbar"))){
elementCaseEditor.setToolBars((FormToolBarManager[]) elementCaseToolBarEditor.getValue());
}
return elementCaseEditor; 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.IntervalConstants;
import com.fr.design.designer.creator.XCreator; 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.foldablepane.UIExpandablePane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner; 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.AbstractDataModify;
import com.fr.design.widget.ui.designer.component.PaddingBoundPane; import com.fr.design.widget.ui.designer.component.PaddingBoundPane;
import com.fr.design.widget.ui.designer.component.TabFitLayoutBackgroundPane; 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.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*; import javax.swing.BorderFactory;
import java.awt.*; import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
/** /**
* Created by ibm on 2017/8/5. * Created by ibm on 2017/8/5.
@ -70,16 +79,47 @@ public class WTabFitLayoutDefinePane extends AbstractDataModify<WTabFitLayout> {
borderStyle.populate(ob); borderStyle.populate(ob);
paddingBoundPane.populate(ob); paddingBoundPane.populate(ob);
componentInterval.setValue(ob.getCompInterval()); componentInterval.setValue(ob.getCompInterval());
if(ob.getCurrentCard() == null){
ob.setCurrentCard(getRelateSwitchButton(ob));
}
titleField.setText(ob.getCurrentCard().getText()); 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 @Override
public WTabFitLayout updateBean() { public WTabFitLayout updateBean() {
WTabFitLayout layout = (WTabFitLayout) creator.toData(); WTabFitLayout layout = (WTabFitLayout) creator.toData();
borderStyle.update(layout); borderStyle.update(layout);
paddingBoundPane.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()); layout.getCurrentCard().setText(titleField.getText());
return layout; 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.designer.creator.XCreator;
import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.accessibles.AccessibleWLayoutBorderStyleEditor; import com.fr.design.mainframe.widget.accessibles.AccessibleWLayoutBorderStyleEditor;
import com.fr.design.widget.ui.designer.AbstractDataModify; import com.fr.design.widget.ui.designer.AbstractDataModify;
import com.fr.design.widget.ui.designer.component.PaddingBoundPane; import com.fr.form.ui.AbstractBorderStyleWidget;
import com.fr.form.ui.*; import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.container.WTitleLayout; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*; import javax.swing.BorderFactory;
import java.awt.*; import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
/** /**
* Created by ibm on 2017/8/3. * Created by ibm on 2017/8/3.
@ -32,7 +34,6 @@ public abstract class WTitleLayoutDefinePane<T extends AbstractBorderStyleWidget
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel advancePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel advancePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
borderStyleEditor = new AccessibleWLayoutBorderStyleEditor(); borderStyleEditor = new AccessibleWLayoutBorderStyleEditor();
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p}; double[] rowSize = {p};
@ -74,7 +75,9 @@ public abstract class WTitleLayoutDefinePane<T extends AbstractBorderStyleWidget
@Override @Override
public T updateBean() { public T updateBean() {
T e = updateSubBean(); T e = updateSubBean();
e.setBorderStyle((LayoutBorderStyle) borderStyleEditor.getValue()); if(!ComparatorUtils.equals(borderStyleEditor.getValue(), e.getBorderStyle())){
e.setBorderStyle((LayoutBorderStyle) borderStyleEditor.getValue());
}
return e; return e;
} }

Loading…
Cancel
Save