Browse Source

Merge pull request #1778 in BA/design from ~PAUL/design:master to master

* commit 'e49e9ae753700003f14407aea0a0a533c8a6edf5': (79 commits)
  改一下国际化
  REPORT-7463 繁体设计器:无法取消勾选打印/导出单元格内容/背景
  REPORT-7454 切换单元格数据集编辑面板部分配置项可能不能刷新显示的问题;处理部分代码质量,防止只因为切换面板就触发保存
  无任务,交互调整
  REPORT-7416 参数面板的相关bug REPORT-7418 帮助符号里的帮助符号点不动,描述见下
  REPORT-7196 组件集合复用在自适应布局里,里面的子组件没有随外面绝对布局框的大小改变而拉伸
  CHART-2144
  REPORT-7245 国际化
  REPORT-7321 1、绝对布局里两个tab点选选不中
  REPORT-7245 @plough:工具栏残留之前打印按钮的痕迹=>兼容老打印方式
  XML_TAG
  REPORT-7343 @plough:国际化
  无JIRA任务, 调整代码,去掉NativePrintConfigManager
  REPORT-7193 使用共享组件后的帮助符号的问题
  REPORT-7193 使用共享组件后的帮助符号的问题
  REPORT-7245 @plough:工具栏残留之前打印按钮的痕迹
  无JIRA任务,使用泛型
  REPORT-7267 @plough:交互问题=>打印顺序改名为分页顺序,移回页面设置中
  REPORT-7321 多选组件时,先点击Ctrl(shift),再分别点几个组件或者直接框选,选不中
  REPORT-7372 9.0启动界面oem支持
  ...
superman 7 years ago
parent
commit
cae31b9682
  1. 11
      designer/src/com/fr/design/actions/insert/flot/ImageFloatAction.java
  2. 74
      designer/src/com/fr/design/actions/report/ReportPrintSettingAction.java
  3. 42
      designer/src/com/fr/design/headerfooter/ImagePane.java
  4. 2
      designer/src/com/fr/design/mainframe/JWorkBook.java
  5. 132
      designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java
  6. 8
      designer/src/com/fr/design/mainframe/form/FormElementCaseDesigner.java
  7. 93
      designer/src/com/fr/design/report/SelectImagePane.java
  8. 15
      designer/src/com/fr/design/webattr/EditReportServerParameterPane.java
  9. 87
      designer/src/com/fr/design/webattr/EditToolBar.java
  10. 57
      designer/src/com/fr/design/webattr/ReportWebWidgetConstants.java
  11. 26
      designer/src/com/fr/design/webattr/ToolBarPane.java
  12. 320
      designer/src/com/fr/design/webattr/printsettings/NativePrintSettingPane.java
  13. 86
      designer/src/com/fr/design/webattr/printsettings/NoClientPrintSettingPane.java
  14. 79
      designer/src/com/fr/design/webattr/printsettings/PageMarginSettingPane.java
  15. 111
      designer/src/com/fr/design/webattr/printsettings/PrintSettingPane.java
  16. 97
      designer/src/com/fr/design/webattr/printsettings/ReportPrintSettingPane.java
  17. 249
      designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java
  18. 17
      designer/src/com/fr/start/ReportSplashPane.java
  19. 13
      designer_base/src/com/fr/design/DesignerEnvManager.java
  20. 11
      designer_base/src/com/fr/design/editor/editor/ColumnRowEditor.java
  21. 34
      designer_base/src/com/fr/design/editor/editor/TextEditor.java
  22. 10
      designer_base/src/com/fr/design/file/NewTemplatePane.java
  23. 62
      designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java
  24. 122
      designer_base/src/com/fr/design/gui/frpane/ImgChoosePane.java
  25. 145
      designer_base/src/com/fr/design/gui/frpane/ImgChooseWrapper.java
  26. 82
      designer_base/src/com/fr/design/gui/ibutton/UIRadioButton.java
  27. 2
      designer_base/src/com/fr/design/gui/ilable/UILabel.java
  28. BIN
      designer_base/src/com/fr/design/images/control/newEdit.png
  29. 31
      designer_base/src/com/fr/design/layout/FRGUIPaneFactory.java
  30. 15
      designer_base/src/com/fr/design/layout/VerticalFlowLayout.java
  31. 26
      designer_base/src/com/fr/design/locale/designer.properties
  32. 26
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  33. 24
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  34. 24
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  35. 26
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  36. 26
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  37. 7
      designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java
  38. 4
      designer_base/src/com/fr/design/mainframe/JTemplate.java
  39. 35
      designer_base/src/com/fr/design/mainframe/backgroundpane/ImageBackgroundQuickPane.java
  40. 86
      designer_base/src/com/fr/design/mainframe/backgroundpane/ImagePreviewPane.java
  41. 1
      designer_base/src/com/fr/design/mainframe/form/FormECDesignerProvider.java
  42. 196
      designer_base/src/com/fr/design/style/background/image/ExpandFileChooser.java
  43. 31
      designer_base/src/com/fr/design/style/background/image/ImageFileChooser.java
  44. 48
      designer_base/src/com/fr/design/style/background/image/ImagePreviewPane.java
  45. 33
      designer_base/src/com/fr/design/style/background/image/ImagePreviewer.java
  46. 41
      designer_base/src/com/fr/design/style/background/image/ImageSelectPane.java
  47. 40
      designer_base/src/com/fr/design/style/background/impl/ImageBackgroundPane.java
  48. 13
      designer_base/src/com/fr/design/style/background/impl/ImageBackgroundPane4Browser.java
  49. 30
      designer_base/src/com/fr/design/style/background/impl/ImageButtonBackgroundPane.java
  50. 178
      designer_base/src/com/fr/design/utils/ImageUtils.java
  51. 48
      designer_base/src/com/fr/design/utils/gui/GUICoreUtils.java
  52. 35
      designer_chart/src/com/fr/design/module/ChartEmptyDataStylePane.java
  53. 18
      designer_chart/src/com/fr/plugin/chart/designer/other/VanChartInteractivePane.java
  54. 9
      designer_form/src/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java
  55. 13
      designer_form/src/com/fr/design/designer/beans/models/SelectionModel.java
  56. 7
      designer_form/src/com/fr/design/designer/creator/XChartEditor.java
  57. 29
      designer_form/src/com/fr/design/designer/creator/XCreator.java
  58. 20
      designer_form/src/com/fr/design/designer/creator/XElementCase.java
  59. 39
      designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java
  60. 3
      designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java
  61. 39
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java
  62. 2
      designer_form/src/com/fr/design/form/util/XCreatorConstants.java
  63. 34
      designer_form/src/com/fr/design/mainframe/CoverPane.java
  64. 4
      designer_form/src/com/fr/design/mainframe/CoverReportPane.java
  65. 57
      designer_form/src/com/fr/design/mainframe/EditingMouseListener.java
  66. 14
      designer_form/src/com/fr/design/mainframe/FormCreatorDropTarget.java
  67. 1
      designer_form/src/com/fr/design/mainframe/FormDesigner.java
  68. 21
      designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java
  69. 1
      designer_form/src/com/fr/design/mainframe/JForm.java
  70. 18
      designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java
  71. 6
      designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java
  72. 18
      designer_form/src/com/fr/design/mainframe/WidgetHelpDialog.java
  73. 69
      designer_form/src/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java
  74. 7
      designer_form/src/com/fr/design/widget/ui/designer/component/PaddingBoundPane.java

11
designer/src/com/fr/design/actions/insert/flot/ImageFloatAction.java

@ -5,7 +5,6 @@ package com.fr.design.actions.insert.flot;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.DynamicUnitList; import com.fr.base.DynamicUnitList;
import com.fr.base.ScreenResolution;
import com.fr.design.actions.ElementCaseAction; import com.fr.design.actions.ElementCaseAction;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
@ -24,9 +23,8 @@ import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.CoreGraphHelper; import com.fr.stable.CoreGraphHelper;
import com.fr.stable.unit.FU; import com.fr.stable.unit.FU;
import javax.swing.*; import javax.swing.KeyStroke;
import java.awt.*; import java.awt.Image;
import java.io.File;
/** /**
* Insert image. * Insert image.
@ -83,10 +81,9 @@ public class ImageFloatAction extends ElementCaseAction {
@Override @Override
public void doOk() { public void doOk() {
File selectedFile = selectImagePane.getSelectedImage(); Image image = selectImagePane.getSelectedImage();
if (selectedFile != null && selectedFile.isFile()) { if (image != null ) {
Image image = BaseUtils.readImage(selectedFile.getPath());
CellImage cellImage = selectImagePane.update(); CellImage cellImage = selectImagePane.update();
CoreGraphHelper.waitForImage(image); CoreGraphHelper.waitForImage(image);

74
designer/src/com/fr/design/actions/report/ReportPrintSettingAction.java

@ -0,0 +1,74 @@
package com.fr.design.actions.report;
import com.fr.base.IconManager;
import com.fr.design.actions.JWorkBookAction;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JWorkBook;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.webattr.printsettings.ReportPrintSettingPane;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.main.TemplateWorkBook;
import com.fr.base.print.PrintSettingsAttrMark;
import com.fr.report.core.ReportUtils;
import javax.swing.KeyStroke;
import java.awt.event.ActionEvent;
/**
* Created by plough on 2018/3/5.
*/
public class ReportPrintSettingAction extends JWorkBookAction {
public ReportPrintSettingAction(JWorkBook jwb) {
super(jwb);
this.setMenuKeySet(REPORT_APP_ATTR);
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon(IconManager.PRINT.getPath()));
this.setSearchText(new ReportPrintSettingPane());
}
/**
* 执行动作
*
* @return 是否执行成功
*/
public void actionPerformed(ActionEvent evt) {
final JWorkBook jwb = getEditingComponent();
if (jwb == null) {
return;
}
final TemplateWorkBook wbTpl = jwb.getTarget();
PrintSettingsAttrMark printSettings = ReportUtils.getPrintSettingsFromWorkbook(wbTpl);
final ReportPrintSettingPane reportPrintSettingPane = new ReportPrintSettingPane();
reportPrintSettingPane.populate(printSettings);
BasicDialog dialog = reportPrintSettingPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
PrintSettingsAttrMark newPrintSettings = reportPrintSettingPane.updateBean();
wbTpl.addAttrMark(newPrintSettings);
jwb.fireTargetModified();
}
});
dialog.setVisible(true);
}
private static final MenuKeySet REPORT_APP_ATTR = new MenuKeySet() {
@Override
public char getMnemonic() { return 'P'; }
@Override
public String getMenuName() {
return Inter.getLocText("FR-Designer_Print_Setting");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
}

42
designer/src/com/fr/design/headerfooter/ImagePane.java

@ -3,25 +3,22 @@
*/ */
package com.fr.design.headerfooter; package com.fr.design.headerfooter;
import java.awt.BorderLayout; import com.fr.design.dialog.BasicPane;
import java.awt.Image; import com.fr.design.gui.frpane.ImgChooseWrapper;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import javax.swing.BorderFactory;
import javax.swing.JFileChooser;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import com.fr.base.BaseUtils;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.dialog.BasicPane;
import com.fr.general.Inter;
import com.fr.stable.CoreGraphHelper;
import com.fr.design.style.background.image.ImageFileChooser; import com.fr.design.style.background.image.ImageFileChooser;
import com.fr.design.style.background.image.ImagePreviewPane; import com.fr.design.style.background.image.ImagePreviewPane;
import com.fr.general.Inter;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.SwingWorker;
import java.awt.BorderLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/** /**
* Image Pane. * Image Pane.
@ -29,6 +26,7 @@ import com.fr.design.style.background.image.ImagePreviewPane;
public class ImagePane extends BasicPane { public class ImagePane extends BasicPane {
private ImagePreviewPane imagePreviewPane; private ImagePreviewPane imagePreviewPane;
private ImageFileChooser imageFileChooser = null; private ImageFileChooser imageFileChooser = null;
private SwingWorker<Void, Void> imageWorker;
public ImagePane() { public ImagePane() {
this(true); this(true);
@ -91,19 +89,7 @@ public class ImagePane extends BasicPane {
ActionListener selectPictureActionListener = new ActionListener() { ActionListener selectPictureActionListener = new ActionListener() {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
int returnVal = imageFileChooser.showOpenDialog(ImagePane.this); int returnVal = imageFileChooser.showOpenDialog(ImagePane.this);
if (returnVal != JFileChooser.CANCEL_OPTION) { ImgChooseWrapper.getInstance(imagePreviewPane, imageFileChooser, null).dealWithImageFile(returnVal);
File selectedFile = imageFileChooser.getSelectedFile();
if (selectedFile != null && selectedFile.isFile()) {
Image image = BaseUtils.readImage(selectedFile.getPath());
CoreGraphHelper.waitForImage(image);
imagePreviewPane.setImage(image);
} else {
imagePreviewPane.setImage(null);
}
imagePreviewPane.repaint();
}
} }
}; };
} }

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

@ -23,6 +23,7 @@ import com.fr.design.actions.file.export.WordExportAction;
import com.fr.design.actions.report.ReportExportAttrAction; import com.fr.design.actions.report.ReportExportAttrAction;
import com.fr.design.actions.report.ReportMobileAttrAction; import com.fr.design.actions.report.ReportMobileAttrAction;
import com.fr.design.actions.report.ReportParameterAction; import com.fr.design.actions.report.ReportParameterAction;
import com.fr.design.actions.report.ReportPrintSettingAction;
import com.fr.design.actions.report.ReportWebAttrAction; import com.fr.design.actions.report.ReportWebAttrAction;
import com.fr.design.cell.bar.DynamicScrollBar; import com.fr.design.cell.bar.DynamicScrollBar;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
@ -650,6 +651,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
new ReportExportAttrAction(this), new ReportExportAttrAction(this),
new ReportParameterAction(this), new ReportParameterAction(this),
new ReportMobileAttrAction(this), new ReportMobileAttrAction(this),
new ReportPrintSettingAction(this),
new NameSeparator(Inter.getLocText("Utils-Current_Sheet")), new NameSeparator(Inter.getLocText("Utils-Current_Sheet")),
}, this.reportComposite.getEditingReportComponent().shortcut4TemplateMenu()); }, this.reportComposite.getEditingReportComponent().shortcut4TemplateMenu());
} }

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

@ -7,13 +7,14 @@ import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.*;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -63,8 +64,14 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
private UICheckBox canBreakOnPaginateCheckBox; private UICheckBox canBreakOnPaginateCheckBox;
private UICheckBox repeatCheckBox; private UICheckBox repeatCheckBox;
private UICheckBox autoHeightCheckBox;
private UICheckBox autoWidthCheckBox; // 自动调整
private UIRadioButton autoHeightRadioButton; // 自动调整行高
private UIRadioButton autoWidthRadioButton; // 自动调整列宽
private UIRadioButton noAutoRadioButton; // 不自动调整
private UIRadioButton defaultAutoRadioButton; // 跟随页面设置(默认)
private UIRadioButton[] adjustRadioButtons;
// 插入行策略 // 插入行策略
private UIButtonGroup insertRowPolicy; private UIButtonGroup insertRowPolicy;
private ValueEditorPane valueEditor; private ValueEditorPane valueEditor;
@ -80,7 +87,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
*/ */
public JPanel createContentPane() { public JPanel createContentPane() {
JPanel downPane = new JPanel(new BorderLayout()); JPanel downPane = new JPanel(new BorderLayout());
downPane.add(new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), HEAD_WDITH, HEAD_HEIGTH, seniorPane()), BorderLayout.NORTH); downPane.add(new UIExpandablePane(Inter.getLocText("FR-Designer_Auto_Adjust_Size"), HEAD_WDITH, HEAD_HEIGTH, seniorPane()), BorderLayout.NORTH);
downPane.add(new UIExpandablePane(Inter.getLocText("FR-Designer_Pagination"), HEAD_WDITH, HEAD_HEIGTH, pagePane()), BorderLayout.CENTER); downPane.add(new UIExpandablePane(Inter.getLocText("FR-Designer_Pagination"), HEAD_WDITH, HEAD_HEIGTH, pagePane()), BorderLayout.CENTER);
JPanel contentPane = new JPanel(new BorderLayout(0, 0)); JPanel contentPane = new JPanel(new BorderLayout(0, 0));
contentPane.add(new UIExpandablePane(Inter.getLocText("FR-Designer_Basic"), HEAD_WDITH, HEAD_HEIGTH, basicPane()), BorderLayout.NORTH); contentPane.add(new UIExpandablePane(Inter.getLocText("FR-Designer_Basic"), HEAD_WDITH, HEAD_HEIGTH, basicPane()), BorderLayout.NORTH);
@ -89,24 +96,36 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
return contentPane; return contentPane;
} }
private JPanel basicPane() { private JPanel basicPane() {
autoHeightCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Auto_Adjust_Height")); defaultAutoRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer_Follow_Paper_Settings"));
autoWidthCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Auto_Adjust_Wdith")); noAutoRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer_No_Auto_Adjust"));
autoHeightCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER); autoHeightRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer_Auto_Adjust_Height"));
autoWidthCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER); autoWidthRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer_Auto_Adjust_Width"));
double p = TableLayout.PREFERRED; adjustRadioButtons = new UIRadioButton[]{
double[] rowSize = {p, p, p, p}; defaultAutoRadioButton, noAutoRadioButton, autoHeightRadioButton, autoWidthRadioButton
double[] columnSize = {p};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}};
Component[][] components = new Component[][]{
new Component[]{null},
new Component[]{autoHeightCheckBox},
new Component[]{autoWidthCheckBox},
new Component[]{null},
}; };
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_LARGE);
// 指定分组
ButtonGroup autoBG = new ButtonGroup();
for (UIRadioButton radioButton : adjustRadioButtons) {
autoBG.add(radioButton);
}
JPanel basicPane = new JPanel() {
@Override
public Insets getInsets() {
return new Insets(LayoutConstants.VGAP_MEDIUM, 0, LayoutConstants.VGAP_MEDIUM, 0);
}
};
VerticalFlowLayout verticalFlowLayout = new VerticalFlowLayout(VerticalFlowLayout.CENTER, 0, 0);
verticalFlowLayout.setAlignLeft(true);
basicPane.setLayout(verticalFlowLayout);
basicPane.add(defaultAutoRadioButton);
basicPane.add(noAutoRadioButton);
basicPane.add(autoHeightRadioButton);
basicPane.add(autoWidthRadioButton);
return basicPane;
} }
private JPanel seniorPane() { private JPanel seniorPane() {
@ -268,12 +287,13 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
private void initAllNames() { private void initAllNames() {
// autoshrik.setGlobalName(Inter.getLocText("FR-Designer_Auto_Adjust_Size")); defaultAutoRadioButton.setGlobalName(Inter.getLocText("FR-Designer_Follow_Paper_Settings"));
autoHeightCheckBox.setGlobalName(Inter.getLocText("FR-Designer_Auto_Adjust_Height")); noAutoRadioButton.setGlobalName(Inter.getLocText("FR-Designer_No_Auto_Adjust"));
autoWidthCheckBox.setGlobalName(Inter.getLocText("FR-Designer_Auto_Adjust_Wdith")); autoHeightRadioButton.setGlobalName(Inter.getLocText("FR-Designer_Auto_Adjust_Height"));
autoWidthRadioButton.setGlobalName(Inter.getLocText("FR-Designer_Auto_Adjust_Width"));
previewCellContent.setGlobalName(Inter.getLocText("FR-Designer_Preview")); previewCellContent.setGlobalName(Inter.getLocText("FR-Designer_Preview"));
printAndExportContent.setGlobalName(Inter.getLocText("CellWrite-Preview_Cell_Content")); printAndExportContent.setGlobalName(Inter.getLocText("FR-Designer_CellWrite_Print_Content"));
printAndExportBackground.setGlobalName(Inter.getLocText("CellWrite-Print_Background")); printAndExportBackground.setGlobalName(Inter.getLocText("FR-Designer_CellWrite_Print_Background"));
showContent.setGlobalName(Inter.getLocText("FR-Designer_Show_Content")); showContent.setGlobalName(Inter.getLocText("FR-Designer_Show_Content"));
fileNameTextField.setGlobalName(Inter.getLocText("FR-Designer_Show_Content")); fileNameTextField.setGlobalName(Inter.getLocText("FR-Designer_Show_Content"));
tooltipTextField.setGlobalName(Inter.getLocText("FR-Designer_CellWrite_ToolTip")); tooltipTextField.setGlobalName(Inter.getLocText("FR-Designer_CellWrite_ToolTip"));
@ -300,27 +320,32 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
if (cellGUIAttr == null) { if (cellGUIAttr == null) {
cellGUIAttr = CellGUIAttr.DEFAULT_CELLGUIATTR; cellGUIAttr = CellGUIAttr.DEFAULT_CELLGUIATTR;
} }
// autoshrik.setSelectedIndex(cellGUIAttr.getAdjustMode());
// 是否在编辑表单中的报表块
boolean isInForm = EastRegionContainerPane.getInstance().getCurrentMode().equals(EastRegionContainerPane.PropertyMode.FORM_REPORT);
defaultAutoRadioButton.setVisible(!isInForm);
switch (cellGUIAttr.getAdjustMode()) { switch (cellGUIAttr.getAdjustMode()) {
case 0: case CellGUIAttr.ADJUST_MODE_NO_AUTO:
autoHeightCheckBox.setSelected(false); noAutoRadioButton.setSelected(true);
autoWidthCheckBox.setSelected(false);
break; break;
case 1: case CellGUIAttr.ADJUST_MODE_AUTO_HEIGHT:
autoHeightCheckBox.setSelected(true); autoHeightRadioButton.setSelected(true);
autoWidthCheckBox.setSelected(false);
break; break;
case 2: case CellGUIAttr.ADJUST_MODE_AUTO_WIDTH:
autoHeightCheckBox.setSelected(false); autoWidthRadioButton.setSelected(true);
autoWidthCheckBox.setSelected(true);
break; break;
case 3: case CellGUIAttr.ADJUST_MODE_DEFAULT:
autoHeightCheckBox.setSelected(true); if (isInForm) {
autoWidthCheckBox.setSelected(true); autoHeightRadioButton.setSelected(true);
} else {
defaultAutoRadioButton.setSelected(true);
}
break; break;
default: default:
break; break;
} }
previewCellContent.setSelected(cellGUIAttr.isPreviewContent()); previewCellContent.setSelected(cellGUIAttr.isPreviewContent());
printAndExportContent.setSelected(cellGUIAttr.isPrintContent()); printAndExportContent.setSelected(cellGUIAttr.isPrintContent());
printAndExportBackground.setSelected(cellGUIAttr.isPrintBackground()); printAndExportBackground.setSelected(cellGUIAttr.isPrintBackground());
@ -384,32 +409,29 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
cellGUIAttr = new CellGUIAttr(); cellGUIAttr = new CellGUIAttr();
} }
// if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Auto_Adjust_Size"))) { for (UIRadioButton radioButton : adjustRadioButtons) {
// cellGUIAttr.setAdjustMode(autoshrik.getSelectedIndex()); if (ComparatorUtils.equals(getGlobalName(), radioButton.getGlobalName())) {
// } // 自动调整
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Auto_Adjust_Height")) || ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Auto_Adjust_Wdith"))) {
int flag; int flag;
if (autoHeightCheckBox.isSelected()) { if (defaultAutoRadioButton.isSelected()) {
if (autoWidthCheckBox.isSelected()) { flag = CellGUIAttr.ADJUST_MODE_DEFAULT;
flag = 3; } else if (autoWidthRadioButton.isSelected()) {
} else { flag = CellGUIAttr.ADJUST_MODE_AUTO_WIDTH;
flag = 1; } else if (autoHeightRadioButton.isSelected()) {
} flag = CellGUIAttr.ADJUST_MODE_AUTO_HEIGHT;
} else if (autoWidthCheckBox.isSelected()) {
flag = 2;
} else { } else {
flag = 0; flag = CellGUIAttr.ADJUST_MODE_NO_AUTO;
} }
cellGUIAttr.setAdjustMode(flag); cellGUIAttr.setAdjustMode(flag);
break;
}
} }
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Preview"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Preview"))) {
cellGUIAttr.setPreviewContent(previewCellContent.isSelected()); cellGUIAttr.setPreviewContent(previewCellContent.isSelected());
} }
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_CellWrite_Preview_Cell_Content"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_CellWrite_Print_Content"))) {
cellGUIAttr.setPrintContent(printAndExportContent.isSelected()); cellGUIAttr.setPrintContent(printAndExportContent.isSelected());
} }

8
designer/src/com/fr/design/mainframe/form/FormElementCaseDesigner.java

@ -130,6 +130,14 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
return image; return image;
} }
/**
* 刷新右侧属性面板
*/
@Override
public void refreshPropertyPane() {
this.elementCasePane.fireSelectionChangeListener();
}
/** /**
* 创建正在编辑的状态. * 创建正在编辑的状态.
* *

93
designer/src/com/fr/design/report/SelectImagePane.java

@ -1,39 +1,34 @@
package com.fr.design.report; package com.fr.design.report;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JFileChooser;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import com.fr.base.BaseUtils;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.frpane.ImgChooseWrapper;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.dialog.BasicPane; import com.fr.design.style.background.image.ImageFileChooser;
import com.fr.design.style.background.image.ImagePreviewPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.report.cell.Elem; import com.fr.report.cell.Elem;
import com.fr.report.cell.cellattr.CellImage; import com.fr.report.cell.cellattr.CellImage;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.CoreGraphHelper;
import com.fr.design.style.background.image.ImageFileChooser; import javax.swing.BorderFactory;
import com.fr.design.style.background.image.ImagePreviewPane; import javax.swing.ButtonGroup;
import com.fr.design.utils.gui.GUICoreUtils; import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.SwingWorker;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/** /**
*
* 这个类主要用于插入图片时的设置 * 这个类主要用于插入图片时的设置
*
*/ */
public class SelectImagePane extends BasicPane{ public class SelectImagePane extends BasicPane {
private ImagePreviewPane previewPane = null; private ImagePreviewPane previewPane = null;
private ImageFileChooser imageFileChooser = null; private ImageFileChooser imageFileChooser = null;
@ -43,9 +38,8 @@ public class SelectImagePane extends BasicPane{
private UIRadioButton adjustRadioButton = null; private UIRadioButton adjustRadioButton = null;
private Style imageStyle = null; private Style imageStyle = null;
private Image previewImage = null;
private File imageFile; private SwingWorker<Void, Void> imageWorker;
public SelectImagePane() { public SelectImagePane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
@ -57,7 +51,7 @@ public class SelectImagePane extends BasicPane{
JPanel previewOwnerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel previewOwnerPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
previewContainerPane.add(previewOwnerPane, BorderLayout.CENTER); previewContainerPane.add(previewOwnerPane, BorderLayout.CENTER);
previewOwnerPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("Preview"),null)); previewOwnerPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("Preview"), null));
previewPane = new ImagePreviewPane(); previewPane = new ImagePreviewPane();
previewOwnerPane.add(new JScrollPane(previewPane)); previewOwnerPane.add(new JScrollPane(previewPane));
@ -73,7 +67,7 @@ public class SelectImagePane extends BasicPane{
selectPictureButton.setMnemonic('S'); selectPictureButton.setMnemonic('S');
selectPictureButton.addActionListener(selectPictureActionListener); selectPictureButton.addActionListener(selectPictureActionListener);
JPanel layoutPane=FRGUIPaneFactory.createMediumHGapHighTopFlowInnerContainer_M_Pane(); JPanel layoutPane = FRGUIPaneFactory.createMediumHGapHighTopFlowInnerContainer_M_Pane();
selectFilePane.add(layoutPane, BorderLayout.CENTER); selectFilePane.add(layoutPane, BorderLayout.CENTER);
//布局 //布局
@ -111,26 +105,11 @@ public class SelectImagePane extends BasicPane{
* Select picture. * Select picture.
*/ */
ActionListener selectPictureActionListener = new ActionListener() { ActionListener selectPictureActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
int returnVal = imageFileChooser int returnVal = imageFileChooser
.showOpenDialog(SelectImagePane.this); .showOpenDialog(SelectImagePane.this);
if (returnVal != JFileChooser.CANCEL_OPTION) { ImgChooseWrapper.getInstance(previewPane, imageFileChooser, imageStyle).dealWithImageFile(returnVal);
File selectedFile = imageFileChooser.getSelectedFile();
if (selectedFile != null && selectedFile.isFile()) {
Image image = BaseUtils.readImage(selectedFile.getPath());
CoreGraphHelper.waitForImage(image);
imageFile = selectedFile;
setImageStyle();
previewPane.setImage(image);
previewPane.setImageStyle(imageStyle);
previewImage = image;
} else {
previewPane.setImage(null);
}
previewPane.repaint();
}
} }
}; };
@ -140,20 +119,21 @@ public class SelectImagePane extends BasicPane{
previewPane.repaint(); previewPane.repaint();
} }
private void setImageStyle(){ private void setImageStyle() {
if(tiledRadioButton.isSelected()){ if (tiledRadioButton.isSelected()) {
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_TILED); imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_TILED);
}else if(adjustRadioButton.isSelected()){ } else if (adjustRadioButton.isSelected()) {
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_ADJUST); imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_ADJUST);
}else if(extendRadioButton.isSelected()){ } else if (extendRadioButton.isSelected()) {
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_EXTEND); imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_EXTEND);
}else{ } else {
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_CENTER); imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_CENTER);
} }
} }
ActionListener layoutActionListener = new ActionListener() { ActionListener layoutActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
setImageStyle(); setImageStyle();
changeImageStyle(); changeImageStyle();
@ -170,21 +150,20 @@ public class SelectImagePane extends BasicPane{
if (cell != null) { if (cell != null) {
Object value = cell.getValue(); Object value = cell.getValue();
if (value != null && value instanceof Image) { if (value != null && value instanceof Image) {
Image image = (Image)value; Image image = (Image) value;
previewPane.setImage(image); previewPane.setImage(image);
this.previewImage = image;
} }
style = cell.getStyle(); style = cell.getStyle();
} }
if(style.getImageLayout() == Constants.IMAGE_TILED){ if (style.getImageLayout() == Constants.IMAGE_TILED) {
tiledRadioButton.setSelected(true); tiledRadioButton.setSelected(true);
}else if(style.getImageLayout() == Constants.IMAGE_EXTEND){ } else if (style.getImageLayout() == Constants.IMAGE_EXTEND) {
extendRadioButton.setSelected(true); extendRadioButton.setSelected(true);
}else if(style.getImageLayout() == Constants.IMAGE_ADJUST){ } else if (style.getImageLayout() == Constants.IMAGE_ADJUST) {
adjustRadioButton.setSelected(true); adjustRadioButton.setSelected(true);
}else{ } else {
style.deriveImageLayout(Constants.IMAGE_CENTER); style.deriveImageLayout(Constants.IMAGE_CENTER);
defaultRadioButton.setSelected(true); defaultRadioButton.setSelected(true);
} }
@ -192,14 +171,14 @@ public class SelectImagePane extends BasicPane{
changeImageStyle(); changeImageStyle();
} }
public CellImage update(){ public CellImage update() {
CellImage cellImage = new CellImage(); CellImage cellImage = new CellImage();
cellImage.setImage(previewPane.getImage()); cellImage.setImage(previewPane.getImage());
cellImage.setStyle(this.imageStyle); cellImage.setStyle(this.imageStyle);
return cellImage; return cellImage;
} }
public File getSelectedImage(){ public Image getSelectedImage() {
return imageFile; return previewPane.getImage();
} }
} }

15
designer/src/com/fr/design/webattr/EditReportServerParameterPane.java

@ -12,7 +12,10 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.webattr.printsettings.PrintSettingPane;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.base.print.PrintSettingsAttrMark;
import com.fr.report.core.ReportUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.web.attr.ReportWebAttr; import com.fr.web.attr.ReportWebAttr;
@ -34,6 +37,7 @@ public class EditReportServerParameterPane extends LoadingBasicPane {
// private FormToolBarPane formPane; // private FormToolBarPane formPane;
private WriteToolBarPane writePane; private WriteToolBarPane writePane;
private ReportWebAttr webAttr; private ReportWebAttr webAttr;
private PrintSettingsAttrMark printSettings;
private WebCssPane cssPane; private WebCssPane cssPane;
@ -41,6 +45,8 @@ public class EditReportServerParameterPane extends LoadingBasicPane {
private ErrorTemplatePane errorTemplatePane; private ErrorTemplatePane errorTemplatePane;
private PrintSettingPane printSettingPane;
@Override @Override
protected synchronized void initComponents(JPanel container) { protected synchronized void initComponents(JPanel container) {
@ -68,6 +74,7 @@ public class EditReportServerParameterPane extends LoadingBasicPane {
tabbedPane.addTab(Inter.getLocText("ReportServerP-Import_Css"), cssPane = new WebCssPane()); tabbedPane.addTab(Inter.getLocText("ReportServerP-Import_Css"), cssPane = new WebCssPane());
tabbedPane.addTab(Inter.getLocText("ReportServerP-Import_JavaScript"), jsPane = new WebJsPane()); tabbedPane.addTab(Inter.getLocText("ReportServerP-Import_JavaScript"), jsPane = new WebJsPane());
tabbedPane.addTab(Inter.getLocText("FR-Designer_ErrorHandlerTemplate"), errorTemplatePane = new ErrorTemplatePane()); tabbedPane.addTab(Inter.getLocText("FR-Designer_ErrorHandlerTemplate"), errorTemplatePane = new ErrorTemplatePane());
tabbedPane.addTab(Inter.getLocText("FR-Designer_Print_Setting"), printSettingPane = new PrintSettingPane());
} }
@Override @Override
@ -86,9 +93,10 @@ public class EditReportServerParameterPane extends LoadingBasicPane {
viewPane.populateBean(webAttr.getWebView()); viewPane.populateBean(webAttr.getWebView());
writePane.populateBean(webAttr.getWebWrite()); writePane.populateBean(webAttr.getWebWrite());
cssPane.populate(webAttr); cssPane.populate(webAttr);
jsPane.populate(webAttr); jsPane.populate(webAttr);
} }
printSettings = ReportUtils.getPrintSettingsFromServerConfig();
printSettingPane.populate(printSettings);
this.errorTemplatePane.populateBean(reportServerConfigManager.getErrorTemplate()); this.errorTemplatePane.populateBean(reportServerConfigManager.getErrorTemplate());
} }
@ -105,11 +113,12 @@ public class EditReportServerParameterPane extends LoadingBasicPane {
webAttr.setWebPage(pagePane.updateBean()); webAttr.setWebPage(pagePane.updateBean());
webAttr.setWebView(viewPane.updateBean()); webAttr.setWebView(viewPane.updateBean());
webAttr.setWebWrite(writePane.updateBean()); webAttr.setWebWrite(writePane.updateBean());
cssPane.update(webAttr); cssPane.update(webAttr);
jsPane.update(webAttr); jsPane.update(webAttr);
printSettings = printSettingPane.updateBean();
((ConfigManager)reportServerConfigManager).getPrintAttr().setPrintSettings(printSettings);
reportServerConfigManager.setErrorTemplate(this.errorTemplatePane.updateBean()); reportServerConfigManager.setErrorTemplate(this.errorTemplatePane.updateBean());
} }
} }

87
designer/src/com/fr/design/webattr/EditToolBar.java

@ -31,18 +31,32 @@ import com.fr.form.ui.WidgetManager;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.report.web.button.Export; import com.fr.report.web.button.Export;
import com.fr.report.web.button.PDFPrint;
import com.fr.report.web.button.Print;
import com.fr.report.web.button.write.AppendColumnRow; import com.fr.report.web.button.write.AppendColumnRow;
import com.fr.report.web.button.write.ExcelImport; import com.fr.report.web.button.write.ExcelImport;
import com.fr.report.web.button.write.Submit; import com.fr.report.web.button.write.Submit;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.DefaultListCellRenderer;
import javax.swing.DefaultListModel;
import javax.swing.ImageIcon;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.ListCellRenderer;
import javax.swing.SpinnerNumberModel;
import javax.swing.SwingUtilities;
import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener; import javax.swing.event.ListSelectionListener;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Image;
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;
@ -320,8 +334,8 @@ public class EditToolBar extends BasicPane {
private CardLayout card; private CardLayout card;
private JPanel centerPane; private JPanel centerPane;
private UICheckBox icon, text, pdf, excelP, excelO, excelS, image, word, private UICheckBox icon, text, pdf, excelP, excelO, excelS, image, word,
flashPrint, pdfPrint, appletPrint, serverPrint, isPopup, isVerify, failSubmit, isPopup, isVerify, failSubmit, isCurSheet, excelImClean,
isCurSheet, excelImClean, excelImCover, excelImAppend, excelImCust; excelImCover, excelImAppend, excelImCust;
private UIBasicSpinner count; private UIBasicSpinner count;
private Widget widget; private Widget widget;
private UITextField nameField; private UITextField nameField;
@ -383,9 +397,7 @@ public class EditToolBar extends BasicPane {
centerPane.add("custom", getCustomPane()); centerPane.add("custom", getCustomPane());
centerPane.add("export", getExport()); centerPane.add("export", getExport());
centerPane.add("import", getImport()); centerPane.add("import", getImport());
centerPane.add("print", getPrint());
centerPane.add("none", none); centerPane.add("none", none);
centerPane.add("pdfprint", getPdfPrintSetting());
// centerPane.add("editexcel", editExcel); // centerPane.add("editexcel", editExcel);
centerPane.add(getCpane(), "appendcount"); centerPane.add(getCpane(), "appendcount");
centerPane.add(getSubmitPane(), "submit"); centerPane.add(getSubmitPane(), "submit");
@ -455,22 +467,6 @@ public class EditToolBar extends BasicPane {
return excelImport; return excelImport;
} }
private JPanel getPrint() {
JPanel print = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
// print.setLayout(new BoxLayout(print, BoxLayout.Y_AXIS));
flashPrint = new UICheckBox(Inter.getLocText("FR-Designer_Flash_Print"));
pdfPrint = new UICheckBox(Inter.getLocText("FR-Designer_PDF_Print"));
appletPrint = new UICheckBox(Inter.getLocText("FR-Designer_Applet_Print"));
serverPrint = new UICheckBox(Inter.getLocText("FR-Designer_Server_Print"));
print.add(flashPrint);
print.add(pdfPrint);
print.add(appletPrint);
print.add(serverPrint);
print.setBorder(BorderFactory.createTitledBorder(Inter.getLocText(new String[]{"Form-Button", "Property", "Set"})));
return print;
}
private JPanel getCpane() { private JPanel getCpane() {
JPanel appendCountPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); JPanel appendCountPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();
count = new UIBasicSpinner(new SpinnerNumberModel(1, 0, Integer.MAX_VALUE, 1)); count = new UIBasicSpinner(new SpinnerNumberModel(1, 0, Integer.MAX_VALUE, 1));
@ -482,17 +478,6 @@ public class EditToolBar extends BasicPane {
return cpane; return cpane;
} }
private JPanel getPdfPrintSetting() {
// richer:pdf打印按钮设置
JPanel pdfPrintSetting = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();
isPopup = new UICheckBox(Inter.getLocText("PDF-Print_isPopup"));
pdfPrintSetting.add(isPopup);
pdfPrintSetting.setBorder(BorderFactory.createTitledBorder(Inter.getLocText("PDF-Print_Setting")));
return pdfPrintSetting;
}
private JPanel getSubmitPane() { private JPanel getSubmitPane() {
isVerify = new UICheckBox(Inter.getLocText("Verify-Data_Verify")); isVerify = new UICheckBox(Inter.getLocText("Verify-Data_Verify"));
failSubmit = new UICheckBox(Inter.getLocText(new String[]{"Verify_Fail", "Still", "Submit"})); failSubmit = new UICheckBox(Inter.getLocText(new String[]{"Verify_Fail", "Still", "Submit"}));
@ -544,10 +529,6 @@ public class EditToolBar extends BasicPane {
} }
if (widget instanceof Export) { if (widget instanceof Export) {
populateExport(); populateExport();
} else if (widget instanceof Print) {
populatePrint();
} else if (widget instanceof PDFPrint) {
populatePDFPrint();
} else if (widget instanceof AppendColumnRow) { } else if (widget instanceof AppendColumnRow) {
populateAppendColumnRow(); populateAppendColumnRow();
} else if (widget instanceof Submit) { } else if (widget instanceof Submit) {
@ -614,21 +595,6 @@ public class EditToolBar extends BasicPane {
this.isCurSheet.setSelected(submit.isOnlySubmitSelect()); this.isCurSheet.setSelected(submit.isOnlySubmitSelect());
} }
private void populatePDFPrint() {
card.show(centerPane, "pdfprint");
PDFPrint pdfPrint = (PDFPrint) widget;
this.isPopup.setSelected(pdfPrint.isPopup());
}
private void populatePrint() {
card.show(centerPane, "print");
Print print = (Print) widget;
this.pdfPrint.setSelected(print.isPDFPrint());
this.appletPrint.setSelected(print.isAppletPrint());
this.flashPrint.setSelected(print.isFlashPrint());
this.serverPrint.setSelected(print.isServerPrint());
}
private void populateDefault() { private void populateDefault() {
Button button = (Button) widget; Button button = (Button) widget;
this.icon.setSelected(button.isShowIcon()); this.icon.setSelected(button.isShowIcon());
@ -645,11 +611,6 @@ public class EditToolBar extends BasicPane {
public Widget update() { public Widget update() {
if (widget instanceof Export) { if (widget instanceof Export) {
updateExport(); updateExport();
} else if (widget instanceof Print) {
updatePrint();
} else if (widget instanceof PDFPrint) {
PDFPrint pdfPrint = (PDFPrint) widget;
pdfPrint.setPopup(this.isPopup.isSelected());
} else if (widget instanceof AppendColumnRow) { } else if (widget instanceof AppendColumnRow) {
((AppendColumnRow) widget).setCount(((Integer) count.getValue()).intValue()); ((AppendColumnRow) widget).setCount(((Integer) count.getValue()).intValue());
} else if (widget instanceof Submit) { } else if (widget instanceof Submit) {
@ -685,14 +646,6 @@ public class EditToolBar extends BasicPane {
submit.setOnlySubmitSelect(this.isCurSheet.isSelected()); submit.setOnlySubmitSelect(this.isCurSheet.isSelected());
} }
private void updatePrint() {
Print print = (Print) widget;
print.setAppletPrint(this.appletPrint.isSelected());
print.setFlashPrint(this.flashPrint.isSelected());
print.setPDFPrint(this.pdfPrint.isSelected());
print.setServerPrint(this.serverPrint.isSelected());
}
private void updateExport() { private void updateExport() {
Export export = (Export) widget; Export export = (Export) widget;
export.setPdfAvailable(this.pdf.isSelected()); export.setPdfAvailable(this.pdf.isSelected());

57
designer/src/com/fr/design/webattr/ReportWebWidgetConstants.java

@ -6,9 +6,45 @@ import com.fr.design.gui.core.WidgetOptionFactory;
import com.fr.form.ui.CustomToolBarButton; import com.fr.form.ui.CustomToolBarButton;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.report.web.button.*; import com.fr.report.web.button.AppletPrint;
import com.fr.report.web.button.page.*; import com.fr.report.web.button.Edit;
import com.fr.report.web.button.write.*; import com.fr.report.web.button.Email;
import com.fr.report.web.button.ExcelO;
import com.fr.report.web.button.ExcelP;
import com.fr.report.web.button.ExcelS;
import com.fr.report.web.button.Export;
import com.fr.report.web.button.FlashPrint;
import com.fr.report.web.button.NewPrint;
import com.fr.report.web.button.PDF;
import com.fr.report.web.button.PDF2;
import com.fr.report.web.button.PDFPrint;
import com.fr.report.web.button.PageSetup;
import com.fr.report.web.button.Print;
import com.fr.report.web.button.PrintPreview;
import com.fr.report.web.button.Scale;
import com.fr.report.web.button.ServerPrint;
import com.fr.report.web.button.Word;
import com.fr.report.web.button.page.First;
import com.fr.report.web.button.page.Last;
import com.fr.report.web.button.page.Next;
import com.fr.report.web.button.page.PageNavi;
import com.fr.report.web.button.page.Previous;
import com.fr.report.web.button.page.SetPrinterOffset;
import com.fr.report.web.button.write.AppendColumnRow;
import com.fr.report.web.button.write.ClearStashedButton;
import com.fr.report.web.button.write.CustomizeImportExcelData;
import com.fr.report.web.button.write.DeleteColumnRow;
import com.fr.report.web.button.write.ExcelImport;
import com.fr.report.web.button.write.ImExcelAppend;
import com.fr.report.web.button.write.ImExcelClean;
import com.fr.report.web.button.write.ImExcelCover;
import com.fr.report.web.button.write.ImportExcelData;
import com.fr.report.web.button.write.ShowCellValue;
import com.fr.report.web.button.write.StashButton;
import com.fr.report.web.button.write.Submit;
import com.fr.report.web.button.write.SubmitForcibly;
import com.fr.report.web.button.write.Verify;
import com.fr.report.web.button.write.WriteOfflineHTML;
import com.fr.stable.bridge.BridgeMark; import com.fr.stable.bridge.BridgeMark;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
@ -17,27 +53,27 @@ public class ReportWebWidgetConstants {
} }
public static WidgetOption[] getPageToolBarInstance() { public static WidgetOption[] getPageToolBarInstance() {
return new WidgetOption[]{FIRST, PREVIOUS, PAGENAVI, NEXT, LAST, SCALE, EMAIL, EXPORT, PDF, EXCELP, EXCELO, EXCELS, WORD, PRINT, FLASHPRINT, APPLETPRINT, PDFPRINT, return new WidgetOption[]{FIRST, PREVIOUS, PAGENAVI, NEXT, LAST, SCALE, EMAIL, EXPORT, PDF, EXCELP, EXCELO, EXCELS, WORD, NEW_PRINT, PRINT, FLASHPRINT, APPLETPRINT, PDFPRINT,
SETPRINTEROFFSET, CUSTOM_BUTTON}; SETPRINTEROFFSET, CUSTOM_BUTTON};
} }
public static WidgetOption[] getViewToolBarInstance() { public static WidgetOption[] getViewToolBarInstance() {
return new WidgetOption[]{PAGESETUP, EMAIL, EXPORT, PDF, EXCELP, EXCELO, EXCELS, WORD, PRINT, FLASHPRINT, APPLETPRINT, PDFPRINT, SETPRINTEROFFSET, PRINTPREVIEW, CUSTOM_BUTTON}; return new WidgetOption[]{PAGESETUP, EMAIL, EXPORT, PDF, EXCELP, EXCELO, EXCELS, WORD, NEW_PRINT, PRINT, FLASHPRINT, APPLETPRINT, PDFPRINT, SETPRINTEROFFSET, PRINTPREVIEW, CUSTOM_BUTTON};
} }
public static WidgetOption[] getPreviewToolBarInstance() { public static WidgetOption[] getPreviewToolBarInstance() {
return new WidgetOption[]{FIRST, PREVIOUS, PAGENAVI, NEXT, LAST, SCALE, EXPORT, PDF, EXCELP, EXCELO, EXCELS, WORD, PRINT, FLASHPRINT, APPLETPRINT, PDFPRINT, return new WidgetOption[]{FIRST, PREVIOUS, PAGENAVI, NEXT, LAST, SCALE, EXPORT, PDF, EXCELP, EXCELO, EXCELS, WORD, NEW_PRINT, PRINT, FLASHPRINT, APPLETPRINT, PDFPRINT,
SETPRINTEROFFSET, CUSTOM_BUTTON}; SETPRINTEROFFSET, CUSTOM_BUTTON};
} }
public static WidgetOption[] getWriteToolBarInstance() { public static WidgetOption[] getWriteToolBarInstance() {
return new WidgetOption[]{SUBMIT, VERIFY, EMAIL, EXPORT, PDF, EXCELP, EXCELO, EXCELS, WORD, PRINT, FLASHPRINT, APPLETPRINT, PDFPRINT, IMPORTEXCELDATA, SHOWCELLVALUE, return new WidgetOption[]{SUBMIT, VERIFY, EMAIL, EXPORT, PDF, EXCELP, EXCELO, EXCELS, WORD, NEW_PRINT, PRINT, FLASHPRINT, APPLETPRINT, PDFPRINT, IMPORTEXCELDATA, SHOWCELLVALUE,
APPENDCOLUMNROW, DELETECOLUMNROW, SETPRINTEROFFSET, CUSTOM_BUTTON, WRITESTASH, WRITESTASHCLEAR, IMPORTEXCELDATA_CUSTOMIZED, APPENDCOLUMNROW, DELETECOLUMNROW, SETPRINTEROFFSET, WRITEOFFLINEHTML, CUSTOM_BUTTON, WRITESTASH, WRITESTASHCLEAR, IMPORTEXCELDATA_CUSTOMIZED,
IMPORTEXCEL, IMPORTEXCEL_COVER, IMPORTEXCEL_CLEAN, IMPORTEXCEL_APPEND}; IMPORTEXCEL, IMPORTEXCEL_COVER, IMPORTEXCEL_CLEAN, IMPORTEXCEL_APPEND};
} }
public static WidgetOption[] getFormToolBarInstance() { public static WidgetOption[] getFormToolBarInstance() {
return new WidgetOption[]{EMAIL, EXPORT, PDF, EXCELP, EXCELO, EXCELS, WORD, PRINT, FLASHPRINT, APPLETPRINT, PDFPRINT, SETPRINTEROFFSET, CUSTOM_BUTTON}; return new WidgetOption[]{EMAIL, EXPORT, PDF, EXCELP, EXCELO, EXCELS, WORD, NEW_PRINT, PRINT, FLASHPRINT, APPLETPRINT, PDFPRINT, SETPRINTEROFFSET, CUSTOM_BUTTON};
} }
// 查询 // 查询
@ -114,7 +150,8 @@ public class ReportWebWidgetConstants {
public static final WidgetOption SCALE = WidgetOptionFactory.createByWidgetClass(Inter.getLocText("FR-Engine_Enlarge_Or_Reduce"), BaseUtils.readIcon("/com/fr/web/images/scale.png"), public static final WidgetOption SCALE = WidgetOptionFactory.createByWidgetClass(Inter.getLocText("FR-Engine_Enlarge_Or_Reduce"), BaseUtils.readIcon("/com/fr/web/images/scale.png"),
Scale.class); Scale.class);
public static final WidgetOption PRINT = WidgetOptionFactory.createByWidgetClass(Inter.getLocText("FR-Engine_Print"), BaseUtils.readIcon("/com/fr/web/images/print.png"), Print.class); public static final WidgetOption NEW_PRINT = WidgetOptionFactory.createByWidgetClass(Inter.getLocText("FR-Engine_Print"), BaseUtils.readIcon("/com/fr/web/images/print.png"), NewPrint.class);
public static final WidgetOption PRINT = WidgetOptionFactory.createByWidgetClass(Inter.getLocText("FR-Engine_Print_Compatible"), BaseUtils.readIcon("/com/fr/web/images/print.png"), Print.class);
public static final WidgetOption APPENDCOLUMNROW = WidgetOptionFactory.createByWidgetClass(Inter.getLocText("Utils-Insert_Record"), public static final WidgetOption APPENDCOLUMNROW = WidgetOptionFactory.createByWidgetClass(Inter.getLocText("Utils-Insert_Record"),
BaseUtils.readIcon("/com/fr/web/images/appendRow.png"), AppendColumnRow.class); BaseUtils.readIcon("/com/fr/web/images/appendRow.png"), AppendColumnRow.class);
public static final WidgetOption DELETECOLUMNROW = WidgetOptionFactory.createByWidgetClass(Inter.getLocText("Utils-Delete_Record"), public static final WidgetOption DELETECOLUMNROW = WidgetOptionFactory.createByWidgetClass(Inter.getLocText("Utils-Delete_Record"),

26
designer/src/com/fr/design/webattr/ToolBarPane.java

@ -7,9 +7,14 @@ import com.fr.design.gui.core.WidgetOption;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.ui.ToolBar; import com.fr.form.ui.ToolBar;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.Inter;
import javax.swing.*; import com.fr.report.web.annotation.OldPrintMethod;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.TransferHandler;
import java.awt.Component;
import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.UnsupportedFlavorException; import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
@ -19,6 +24,7 @@ import java.util.List;
public class ToolBarPane extends BasicBeanPane<ToolBar> { public class ToolBarPane extends BasicBeanPane<ToolBar> {
private FToolBar ftoolbar = new FToolBar(); private FToolBar ftoolbar = new FToolBar();
private boolean populateFinished = false; // 正在 populate 数据
public ToolBarPane() { public ToolBarPane() {
super(); super();
@ -79,6 +85,10 @@ public class ToolBarPane extends BasicBeanPane<ToolBar> {
*/ */
public Component add(Component comp) { public Component add(Component comp) {
if (comp instanceof ToolBarButton) { if (comp instanceof ToolBarButton) {
if (isPopulateFinished() && ((ToolBarButton) comp).getWidget().getClass().isAnnotationPresent(OldPrintMethod.class)) {
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(this), Inter.getLocText("FR-Designer_Use_New_Print_Tip"));
return comp;
}
this.ftoolbar.addButton((ToolBarButton) comp); this.ftoolbar.addButton((ToolBarButton) comp);
} }
return super.add(comp); return super.add(comp);
@ -128,6 +138,7 @@ public class ToolBarPane extends BasicBeanPane<ToolBar> {
@Override @Override
public void populateBean(ToolBar toolbar) { public void populateBean(ToolBar toolbar) {
setPopulateFinished(false);
this.removeAll(); this.removeAll();
this.getFToolBar().clearButton(); this.getFToolBar().clearButton();
for (int j = 0; j < toolbar.getWidgetSize(); j++) { for (int j = 0; j < toolbar.getWidgetSize(); j++) {
@ -146,6 +157,7 @@ public class ToolBarPane extends BasicBeanPane<ToolBar> {
} }
this.getFToolBar().setBackground(toolbar.getBackground()); this.getFToolBar().setBackground(toolbar.getBackground());
this.getFToolBar().setDefault(toolbar.isDefault()); this.getFToolBar().setDefault(toolbar.isDefault());
setPopulateFinished(true);
} }
@Override @Override
@ -171,6 +183,14 @@ public class ToolBarPane extends BasicBeanPane<ToolBar> {
} }
}; };
private boolean isPopulateFinished() {
return populateFinished;
}
private void setPopulateFinished(boolean populateFinished) {
this.populateFinished = populateFinished;
}
/* /*
* 拖拽属性设置 * 拖拽属性设置

320
designer/src/com/fr/design/webattr/printsettings/NativePrintSettingPane.java

@ -0,0 +1,320 @@
package com.fr.design.webattr.printsettings;
import com.fr.base.PaperSize;
import com.fr.base.Utils;
import com.fr.base.print.NativePrintAttr;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.report.stable.ReportConstants;
import javax.print.DocFlavor;
import javax.print.PrintService;
import javax.print.PrintServiceLookup;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.SpinnerNumberModel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.HashSet;
import java.util.Set;
/**
* Created by plough on 2018/3/5.
*/
public class NativePrintSettingPane extends JPanel {
private UICheckBox isShowDialogCheck;
private UIComboBox printerComboBox;
private UIBasicSpinner copySpinner; // 份数
private UIRadioButton allPageRadioButton;
private UIRadioButton currentPageRadioButton;
private UIRadioButton customPageRadioButton;
private UITextField specifiedAreaField;
private UIComboBox predefinedPaperSizeComboBox;
private UICheckBox inheritPagePaperSettingCheck;
private UICheckBox inheritPageLayoutSettingCheck;
private UICheckBox inheritPageMarginSettingCheck;
private UICheckBox fitPaperSizeCheck; // 缩放
private UIRadioButton portraitRadioButton;
private UIRadioButton landscapeRadioButton;
private PageMarginSettingPane pageMarginSettingPane;
public NativePrintSettingPane() {
initComponents();
initListeners();
}
private void initComponents() {
JPanel printPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel northPane = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(1, 0, 15);
UILabel tipDownload = GUICoreUtils.createTipLabel(Inter.getLocText("FR-Designer_Tip_Native_Print_Need_Client"));
northPane.add(tipDownload);
isShowDialogCheck = new UICheckBox(Inter.getLocText("FR-Engine_Show_Print_Setting_Window_When_Printing"));
isShowDialogCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20));
UILabel tipCheck = GUICoreUtils.createTipLabel(Inter.getLocText("FR-Designer_Tip_Use_Default_Settings"));
JPanel checkPane = GUICoreUtils.createFlowPane(new Component[] {
isShowDialogCheck, tipCheck}, FlowLayout.LEFT);
northPane.add(checkPane);
northPane.setBorder(BorderFactory.createEmptyBorder(3, 10, 10, 0));
printPane.add(northPane, BorderLayout.NORTH);
JPanel centerPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Default_Settings"));
UIScrollPane scrollPane = new UIScrollPane(getNativePrintMainSettingPane());
scrollPane.setBorder(null);
scrollPane.setPreferredSize(new Dimension(600, 340));
centerPane.add(scrollPane);
printPane.add(centerPane, BorderLayout.CENTER);
this.setLayout(new BorderLayout());
this.add(printPane, BorderLayout.CENTER);
}
private void initListeners() {
allPageRadioButton.addItemListener(getPageRaidoListener());
currentPageRadioButton.addItemListener(getPageRaidoListener());
customPageRadioButton.addItemListener(getPageRaidoListener());
}
private ItemListener getPageRaidoListener() {
return new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
specifiedAreaField.setEnabled(customPageRadioButton.isSelected());
}
};
}
private JPanel getNativePrintMainSettingPane() {
// 打印机
String[] printerArray = getAllPrinterNames();
printerComboBox = new UIComboBox(printerArray);
printerComboBox.setPreferredSize(new Dimension(200, printerComboBox.getPreferredSize().height));
JPanel printerPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
printerPane.add(printerComboBox);
// 份数
copySpinner = new UIBasicSpinner(new SpinnerNumberModel(1, 0, Integer.MAX_VALUE, 1));
GUICoreUtils.setColumnForSpinner(copySpinner, 5);
JPanel copyPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
copyPane.add(copySpinner);
// 继承页面纸张设置
inheritPagePaperSettingCheck = GUICoreUtils.createNoBorderCheckBox(Inter.getLocText("FR-Designer_Inherit_Page_Paper_Setting"));
JPanel paperSettingPane = getPaperSettingPane();
JPanel paperSettingCheckPane = GUICoreUtils.createCheckboxAndDynamicPane(inheritPagePaperSettingCheck, paperSettingPane, true);
// 继承页面布局设置
inheritPageLayoutSettingCheck = GUICoreUtils.createNoBorderCheckBox(Inter.getLocText("FR-Designer_Inherit_Page_Layout_Setting"));
JPanel layoutSettingPane = getLayoutSettingPane();
JPanel layoutSettingCheckPane = GUICoreUtils.createCheckboxAndDynamicPane(inheritPageLayoutSettingCheck, layoutSettingPane, true);
// 页码标签
UILabel printAreaLabel = new UILabel(Inter.getLocText("FR-Engine-Page_Number") + ":");
JPanel printAreaLabelPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
printAreaLabelPane.add(printAreaLabel, BorderLayout.NORTH);
printAreaLabel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
// 边距
inheritPageMarginSettingCheck = GUICoreUtils.createNoBorderCheckBox(Inter.getLocText("FR-Designer_Inherit_Page_Margin_Setting"));
pageMarginSettingPane = new PageMarginSettingPane();
pageMarginSettingPane.setBorder(BorderFactory.createEmptyBorder(10, -10, 0, 0));
JPanel pageMarginCheckPane = GUICoreUtils.createCheckboxAndDynamicPane(inheritPageMarginSettingCheck, pageMarginSettingPane, true);
// 缩放
fitPaperSizeCheck = GUICoreUtils.createNoBorderCheckBox(Inter.getLocText("FR-Designer_Print_To_Fit_Paper_Size"));
// TableLayout
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p, p};
double[] columnSize = {60, p};
Component[][] components = {
{new UILabel(Inter.getLocText("FR-Designer_Printer") + ":"), printerPane},
{new UILabel(Inter.getLocText("FR-Designer_Copy_Number") + ":"), copyPane},
{printAreaLabelPane, getPrintAreaPane()},
{getTopAlignLabelPane(Inter.getLocText("FR-Designer_Paper") + ":"), paperSettingCheckPane},
{getTopAlignLabelPane(Inter.getLocText("FR-Designer_Layout") + ":"), layoutSettingCheckPane},
{getTopAlignLabelPane(Inter.getLocText("FR-Designer_Margin") + ":"), pageMarginCheckPane}
// 此功能暂时不做,在界面上隐藏缩放选项
// {new UILabel(Inter.getLocText("FR-Designer_Scale_EnlargeOrReduce") + ":"), fitPaperSizeCheck},
};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 15);
}
private String[] getAllPrinterNames() {
PrintService[] printServices = PrintServiceLookup.lookupPrintServices(
DocFlavor.INPUT_STREAM.AUTOSENSE, null);
Set<String> allPrinterName = new HashSet<String>();
for (int i = 0, len = printServices.length; i < len; i++) {
allPrinterName.add(printServices[i].getName());
}
return allPrinterName.toArray(new String[allPrinterName.size()]);
}
private JPanel getPaperSettingPane() {
predefinedPaperSizeComboBox = new UIComboBox();
for (int i = 0; i < ReportConstants.PaperSizeNameSizeArray.length; i++) {
Object[] tmpPaperSizeNameArray = ReportConstants.PaperSizeNameSizeArray[i];
predefinedPaperSizeComboBox.addItem(tmpPaperSizeNameArray[1]);
}
predefinedPaperSizeComboBox.setRenderer(new UIComboBoxRenderer() {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value instanceof PaperSize) {
PaperSize paperSize = (PaperSize) value;
for (int i = 0; i < ReportConstants.PaperSizeNameSizeArray.length; i++) {
Object[] tmpPaperSizeNameArray = ReportConstants.PaperSizeNameSizeArray[i];
if (ComparatorUtils.equals(paperSize, tmpPaperSizeNameArray[1])) {
String sbuf = tmpPaperSizeNameArray[0].toString() + " [" +
Utils.convertNumberStringToString(paperSize.getWidth().toMMValue4Scale2()) +
'x' +
Utils.convertNumberStringToString(paperSize.getHeight().toMMValue4Scale2()) +
' ' +
Inter.getLocText("PageSetup-mm") +
']';
this.setText(sbuf);
break;
}
}
}
return this;
}
});
JPanel panel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
panel.add(predefinedPaperSizeComboBox);
panel.setBorder(BorderFactory.createEmptyBorder(8, 0, 0, 0));
return panel;
}
private JPanel getLayoutSettingPane() {
JPanel layoutSettingPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
layoutSettingPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
portraitRadioButton = new UIRadioButton(Inter.getLocText("PageSetup-Portrait"));
portraitRadioButton.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20));
landscapeRadioButton = new UIRadioButton(Inter.getLocText("PageSetup-Landscape"));
layoutSettingPane.add(portraitRadioButton);
layoutSettingPane.add(landscapeRadioButton);
ButtonGroup layoutButtonGroup = new ButtonGroup();
layoutButtonGroup.add(portraitRadioButton);
layoutButtonGroup.add(landscapeRadioButton);
portraitRadioButton.setSelected(true);
return layoutSettingPane;
}
// 页码范围
private JPanel getPrintAreaPane() {
allPageRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer_All_Pages"));
currentPageRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer_Current_Page"));
customPageRadioButton = new UIRadioButton(Inter.getLocText("FR-Engine_HJS-Specified_Pages"));
ButtonGroup group = new ButtonGroup();
group.add(allPageRadioButton);
group.add(currentPageRadioButton);
group.add(customPageRadioButton);
allPageRadioButton.setSelected(true);
specifiedAreaField = new UITextField(20);
UILabel areaFieldTip = GUICoreUtils.createTipLabel(Inter.getLocText("FR-Designer_Print_Area_Tip"));
// TableLayout
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p};
double[] columnSize = {p, p, p};
Component[][] components = {
{allPageRadioButton, null, null},
{currentPageRadioButton, null, null},
{customPageRadioButton, specifiedAreaField, areaFieldTip}
};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 0);
}
// 返回包含一个标签的 panel,标签始终位于 panel 顶部
private JPanel getTopAlignLabelPane(String labelText) {
JPanel labelPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
labelPane.add(new UILabel(labelText), BorderLayout.NORTH);
return labelPane;
}
public void populate(NativePrintAttr nativePrintAttr) {
isShowDialogCheck.setSelected(nativePrintAttr.isShowDialog());
printerComboBox.setSelectedItem(nativePrintAttr.getPrinterName());
copySpinner.setValue(nativePrintAttr.getCopy());
if (nativePrintAttr.getPageType().equals(NativePrintAttr.PageType.ALL_PAGES)) {
allPageRadioButton.setSelected(true);
} else if (nativePrintAttr.getPageType().equals(NativePrintAttr.PageType.CURRENT_PAGE)) {
currentPageRadioButton.setSelected(true);
} else {
customPageRadioButton.setSelected(true);
specifiedAreaField.setText(nativePrintAttr.getArea());
}
specifiedAreaField.setEnabled(customPageRadioButton.isSelected());
inheritPagePaperSettingCheck.setSelected(nativePrintAttr.isInheritPagePaperSetting());
predefinedPaperSizeComboBox.setSelectedItem(nativePrintAttr.getPaperSize());
inheritPageLayoutSettingCheck.setSelected(nativePrintAttr.isInheritPageLayoutSetting());
if (nativePrintAttr.getOrientation() == ReportConstants.PORTRAIT) {
portraitRadioButton.setSelected(true);
} else {
landscapeRadioButton.setSelected(true);
}
inheritPageMarginSettingCheck.setSelected(nativePrintAttr.isInheritPageMarginSetting());
pageMarginSettingPane.populate(nativePrintAttr.getMargin());
fitPaperSizeCheck.setSelected(nativePrintAttr.isFitPaperSize());
}
public void update(NativePrintAttr nativePrintAttr) {
nativePrintAttr.setShowDialog(isShowDialogCheck.isSelected());
if (printerComboBox.getSelectedItem() != null) {
nativePrintAttr.setPrinterName(printerComboBox.getSelectedItem().toString());
}
nativePrintAttr.setCopy((int)copySpinner.getValue());
// 页码
if (allPageRadioButton.isSelected()) {
nativePrintAttr.setPageType(NativePrintAttr.PageType.ALL_PAGES);
} else if (currentPageRadioButton.isSelected()) {
nativePrintAttr.setPageType(NativePrintAttr.PageType.CURRENT_PAGE);
} else {
nativePrintAttr.setPageType(NativePrintAttr.PageType.SPECIFIED_PAGES);
nativePrintAttr.setArea(specifiedAreaField.getText());
}
nativePrintAttr.setInheritPagePaperSetting(inheritPagePaperSettingCheck.isSelected());
nativePrintAttr.setPaperSize((PaperSize) predefinedPaperSizeComboBox.getSelectedItem());
nativePrintAttr.setInheritPageLayoutSetting(inheritPageLayoutSettingCheck.isSelected());
nativePrintAttr.setOrientation(portraitRadioButton.isSelected() ?
ReportConstants.PORTRAIT : ReportConstants.LANDSCAPE);
nativePrintAttr.setInheritPageMarginSetting(inheritPageMarginSettingCheck.isSelected());
nativePrintAttr.setMargin(pageMarginSettingPane.updateBean());
nativePrintAttr.setFitPaperSize(fitPaperSizeCheck.isSelected());
}
}

86
designer/src/com/fr/design/webattr/printsettings/NoClientPrintSettingPane.java

@ -0,0 +1,86 @@
package com.fr.design.webattr.printsettings;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import com.fr.base.print.NoClientPrintAttr;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.FlowLayout;
/**
* 零客户端打印设置面板
* Created by plough on 2018/3/5.
*/
public class NoClientPrintSettingPane extends JPanel {
private UICheckBox setMarginWhenPrintCheck;
private UICheckBox inheritPageMarginSettingCheck; // 继承页面边距设置
private PageMarginSettingPane pageMarginSettingPane;
public NoClientPrintSettingPane() {
initComponents();
}
private void initComponents() {
JPanel printPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
setMarginWhenPrintCheck = new UICheckBox(Inter.getLocText("FR-Engine_Set_Margin_When_Printing"));
setMarginWhenPrintCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20));
UILabel tipLabel = GUICoreUtils.createTipLabel(Inter.getLocText("FR-Designer_Tip_Use_Default_Print_Margin"));
JPanel northPane = GUICoreUtils.createFlowPane(new Component[] {
setMarginWhenPrintCheck, tipLabel}, FlowLayout.LEFT);
northPane.setBorder(BorderFactory.createEmptyBorder(8, 10, 10, 0));
printPane.add(northPane, BorderLayout.NORTH);
JPanel centerPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Default_Settings"));
inheritPageMarginSettingCheck = GUICoreUtils.createNoBorderCheckBox(Inter.getLocText("FR-Designer_Inherit_Page_Margin_Setting"));
pageMarginSettingPane = new PageMarginSettingPane();
pageMarginSettingPane.setBorder(BorderFactory.createEmptyBorder(10, -10, 0, 0));
JPanel pageMarginCheckPane = GUICoreUtils.createCheckboxAndDynamicPane(inheritPageMarginSettingCheck, pageMarginSettingPane, true);
// TableLayout
double p = TableLayout.PREFERRED;
double[] rowSize = {p};
double[] columnSize = {60, p};
Component[][] components = {
{getTopAlignLabelPane(Inter.getLocText("FR-Designer_Margin") + ":"), pageMarginCheckPane}
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 15);
centerPane.add(panel);
printPane.add(centerPane, BorderLayout.CENTER);
this.setLayout(new BorderLayout());
this.add(printPane, BorderLayout.CENTER);
}
// 返回包含一个标签的 panel,标签始终位于 panel 顶部
private JPanel getTopAlignLabelPane(String labelText) {
JPanel labelPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
labelPane.add(new UILabel(labelText), BorderLayout.NORTH);
return labelPane;
}
public void populate(NoClientPrintAttr noClientPrintAttr) {
setMarginWhenPrintCheck.setSelected(noClientPrintAttr.isSetMarginOnPrint());
inheritPageMarginSettingCheck.setSelected(noClientPrintAttr.isInheritPageMarginSetting());
pageMarginSettingPane.populate(noClientPrintAttr.getMargin());
}
public void update(NoClientPrintAttr noClientPrintAttr) {
noClientPrintAttr.setSetMarginOnPrint(setMarginWhenPrintCheck.isSelected());
noClientPrintAttr.setInheritPageMarginSetting(inheritPageMarginSettingCheck.isSelected());
noClientPrintAttr.setMargin(pageMarginSettingPane.updateBean());
}
}

79
designer/src/com/fr/design/webattr/printsettings/PageMarginSettingPane.java

@ -0,0 +1,79 @@
package com.fr.design.webattr.printsettings;
import com.fr.base.Margin;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.report.UnitFieldPane;
import com.fr.general.Inter;
import com.fr.stable.Constants;
import javax.swing.JPanel;
import java.awt.BorderLayout;
/**
* Created by plough on 2018/3/5.
*/
public class PageMarginSettingPane extends JPanel {
private UnitFieldPane marginTopUnitFieldPane;
private UnitFieldPane marginBottomUnitFieldPane;
private UnitFieldPane marginLeftUnitFieldPane;
private UnitFieldPane marginRightUnitFieldPane;
public PageMarginSettingPane() {
initComponents();
}
private void initComponents() {
// 页边距设置面板
JPanel marginPane = FRGUIPaneFactory.createX_AXISBoxInnerContainer_M_Pane();
// left
JPanel marginLeftPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane();
marginPane.add(marginLeftPane);
JPanel marginLeftTextPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
marginLeftPane.add(marginLeftTextPane);
marginLeftTextPane.add(new UILabel(Inter.getLocText("Top") + ":"));
marginTopUnitFieldPane = new UnitFieldPane(Constants.UNIT_MM);
marginLeftTextPane.add(marginTopUnitFieldPane);
JPanel marginLeftUnitPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
marginLeftPane.add(marginLeftUnitPane);
marginLeftUnitPane.add(new UILabel(Inter.getLocText("Bottom") + ":"));
marginBottomUnitFieldPane = new UnitFieldPane(Constants.UNIT_MM);
marginLeftUnitPane.add(marginBottomUnitFieldPane);
// right
JPanel marginRightPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane();
marginPane.add(marginRightPane);
// peter:这个一个垂直的上下的字符panel.
JPanel marginRightTextPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
marginRightPane.add(marginRightTextPane);
marginRightTextPane.add(new UILabel(Inter.getLocText("Left") + ":"));
marginLeftUnitFieldPane = new UnitFieldPane(Constants.UNIT_MM);
marginRightTextPane.add(marginLeftUnitFieldPane);
JPanel marginRightUnitPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
marginRightPane.add(marginRightUnitPane);
marginRightUnitPane.add(new UILabel(Inter.getLocText("Right") + ":"));
marginRightUnitFieldPane = new UnitFieldPane(Constants.UNIT_MM);
marginRightUnitPane.add(marginRightUnitFieldPane);
this.setLayout(new BorderLayout());
this.add(marginPane, BorderLayout.CENTER);
}
public void populate(Margin margin) {
marginTopUnitFieldPane.setUnitValue(margin.getTop());
marginLeftUnitFieldPane.setUnitValue(margin.getLeft());
marginBottomUnitFieldPane.setUnitValue(margin.getBottom());
marginRightUnitFieldPane.setUnitValue(margin.getRight());
}
public Margin updateBean() {
Margin margin = new Margin();
margin.setTop(marginTopUnitFieldPane.getUnitValue());
margin.setLeft(marginLeftUnitFieldPane.getUnitValue());
margin.setBottom(marginBottomUnitFieldPane.getUnitValue());
margin.setRight(marginRightUnitFieldPane.getUnitValue());
return margin;
}
}

111
designer/src/com/fr/design/webattr/printsettings/PrintSettingPane.java

@ -0,0 +1,111 @@
package com.fr.design.webattr.printsettings;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import com.fr.base.print.PrintSettingsAttrMark;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
/**
* Created by plough on 2018/3/1.
*/
public class PrintSettingPane extends BasicPane {
private UIRadioButton noClientPrintRadioButton = new UIRadioButton(Inter.getLocText("FR-Engine_No_Client_Print"));
private UIRadioButton nativePrintRadioButton = new UIRadioButton(Inter.getLocText("FR-Engine_Native_Print"));
private NoClientPrintSettingPane noClientPrintSettingPane;
private NativePrintSettingPane nativePrintSettingPane;
private CardLayout printCard;
private JPanel printPane;
public PrintSettingPane() {
initComponents();
initListener();
}
private void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel allPanel = FRGUIPaneFactory.createBorderLayout_L_Pane();
this.add(allPanel, BorderLayout.CENTER);
JPanel north = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true);
allPanel.add(north, BorderLayout.NORTH);
ButtonGroup buttonGroup = new ButtonGroup();
noClientPrintRadioButton.setSelected(true);
buttonGroup.add(noClientPrintRadioButton);
buttonGroup.add(nativePrintRadioButton);
noClientPrintRadioButton.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 50));
JPanel radioGroupPane = GUICoreUtils.createFlowPane(new Component[] {
noClientPrintRadioButton, nativePrintRadioButton}, FlowLayout.LEFT, 0, 0);
north.add(radioGroupPane);
noClientPrintSettingPane = new NoClientPrintSettingPane();
nativePrintSettingPane = new NativePrintSettingPane();
printCard = new CardLayout();
printPane = new JPanel();
printPane.setLayout(printCard);
printPane.add(noClientPrintRadioButton.getText(), noClientPrintSettingPane);
printPane.add(nativePrintRadioButton.getText(), nativePrintSettingPane);
north.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
allPanel.add(printPane, BorderLayout.CENTER);
}
private void initListener() {
noClientPrintRadioButton.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
printCard.show(printPane, noClientPrintRadioButton.getText());
}
}
});
nativePrintRadioButton.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
printCard.show(printPane, nativePrintRadioButton.getText());
}
}
});
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Print_Setting");
}
public void populate(PrintSettingsAttrMark printSettings) {
if (printSettings.getPrintType() == PrintSettingsAttrMark.NO_CLIENT_PRINT) {
noClientPrintRadioButton.setSelected(true);
} else {
nativePrintRadioButton.setSelected(true);
}
noClientPrintSettingPane.populate(printSettings.getNoClientPrintAttr());
nativePrintSettingPane.populate(printSettings.getNativePrintAttr());
}
public PrintSettingsAttrMark updateBean() {
PrintSettingsAttrMark printSettings = new PrintSettingsAttrMark();
printSettings.setPrintType(noClientPrintRadioButton.isSelected() ?
PrintSettingsAttrMark.NO_CLIENT_PRINT : PrintSettingsAttrMark.NATIVE_PRINT);
if (noClientPrintRadioButton.isSelected()) {
printSettings.setPrintType(PrintSettingsAttrMark.NO_CLIENT_PRINT);
noClientPrintSettingPane.update(printSettings.getNoClientPrintAttr());
} else {
printSettings.setPrintType(PrintSettingsAttrMark.NATIVE_PRINT);
nativePrintSettingPane.update(printSettings.getNativePrintAttr());
}
return printSettings;
}
}

97
designer/src/com/fr/design/webattr/printsettings/ReportPrintSettingPane.java

@ -0,0 +1,97 @@
package com.fr.design.webattr.printsettings;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import com.fr.base.print.PrintSettingsAttrMark;
import com.fr.report.core.ReportUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
/**
* 模版->打印设置
* Created by plough on 2018/3/6.
*/
public class ReportPrintSettingPane extends BasicPane {
private static final String[] CHOOSEITEM = new String[] {
Inter.getLocText("FR-Designer_I_Want_To_Set_Single"),
Inter.getLocText("FR-Designer_Using_Server_Report_View_Settings")
};
private static final int SINGLE_SET = 0;
private static final int SERVER_SET = 1;
private UIComboBox chooseComboBox;
private PrintSettingPane printSettingPane;
public ReportPrintSettingPane() {
initComponents();
}
private void initComponents() {
chooseComboBox = new UIComboBox(CHOOSEITEM);
chooseComboBox.addItemListener(itemListener);
UILabel belowSetLabel = new UILabel(Inter.getLocText("FR-Designer_Blow_set") + ":");
JPanel buttonPane = GUICoreUtils.createFlowPane(new Component[] {
belowSetLabel, chooseComboBox}, FlowLayout.LEFT, 0, 0);
buttonPane.setBorder(BorderFactory.createEmptyBorder(10, 20, 0, 0));
printSettingPane = new PrintSettingPane();
this.setLayout(new BorderLayout());
this.add(buttonPane, BorderLayout.NORTH);
this.add(printSettingPane, BorderLayout.CENTER);
}
private ItemListener itemListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
if (chooseComboBox.getSelectedIndex() == 0) {
checkEnabled(true);
} else {
populateServerSettings();
checkEnabled(false);
}
}
}
};
private void checkEnabled(boolean isSelected) {
GUICoreUtils.setEnabled(printSettingPane, isSelected);
}
private void populateServerSettings() {
PrintSettingsAttrMark printSettings = ReportUtils.getPrintSettingsFromServerConfig();
printSettingPane.populate(printSettings);
}
public void populate(PrintSettingsAttrMark printSettings) {
if (!printSettings.isValid()) { // 采用服务器配置
chooseComboBox.setSelectedIndex(SERVER_SET);
populateServerSettings();
return;
}
chooseComboBox.setSelectedIndex(SINGLE_SET);
printSettingPane.populate(printSettings);
}
public PrintSettingsAttrMark updateBean() {
PrintSettingsAttrMark printSettings = printSettingPane.updateBean();
if (chooseComboBox.getSelectedIndex() == SERVER_SET) {
printSettings.setValid(false);
}
return printSettings;
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Print_Setting");
}
}

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

@ -35,6 +35,7 @@ import com.fr.report.cell.cellattr.CellExpandAttr;
import com.fr.report.cell.cellattr.core.group.DSColumn; import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.report.cell.cellattr.core.group.FilterTypeEnum; import com.fr.report.cell.cellattr.core.group.FilterTypeEnum;
import com.fr.report.cell.cellattr.core.group.SelectCount; import com.fr.report.cell.cellattr.core.group.SelectCount;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
@ -74,9 +75,6 @@ public class CellDSColumnEditor extends CellQuickEditor {
private static final Color TIP_FONT_COLOR = new Color(0x7F333334, true); private static final Color TIP_FONT_COLOR = new Color(0x7F333334, true);
private JPanel dsColumnRegion;
private JPanel centerPane;
/** /**
* 基本和高级设置 * 基本和高级设置
*/ */
@ -117,10 +115,10 @@ public class CellDSColumnEditor extends CellQuickEditor {
public JComponent createCenterBody() { public JComponent createCenterBody() {
this.createPanes(); this.createPanes();
this.createSwitchTab(); this.createSwitchTab();
dsColumnRegion = new JPanel(new BorderLayout()); JPanel dsColumnRegion = new JPanel(new BorderLayout());
dsColumnRegion.add(tabsHeaderIconPane, BorderLayout.NORTH); dsColumnRegion.add(tabsHeaderIconPane, BorderLayout.NORTH);
dsColumnRegion.add(cardContainer, BorderLayout.CENTER); dsColumnRegion.add(cardContainer, BorderLayout.CENTER);
centerPane = new JPanel(new BorderLayout()); JPanel centerPane = new JPanel(new BorderLayout());
centerPane.add(dsColumnRegion, BorderLayout.CENTER); centerPane.add(dsColumnRegion, BorderLayout.CENTER);
return centerPane; return centerPane;
} }
@ -331,6 +329,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
class DSColumnAdvancedEditorPane extends AbstractDSCellEditorPane { class DSColumnAdvancedEditorPane extends AbstractDSCellEditorPane {
/*pane begin*/
/** /**
* 排列顺序 * 排列顺序
*/ */
@ -354,7 +353,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
/** /**
* 补充空白数据 * 补充空白数据
*/ */
private UICheckBox useMultiplyNumCheckBox; private UICheckBox useMultiNumCheckBox;
/** /**
* 补充空白数据数目输入框 * 补充空白数据数目输入框
*/ */
@ -363,6 +362,75 @@ public class CellDSColumnEditor extends CellQuickEditor {
* 补充空白数据数目面板 可隐藏 * 补充空白数据数目面板 可隐藏
*/ */
private JPanel multiPane; private JPanel multiPane;
/*pane end*/
/*listeners begin*/
private UIObserverListener sortPaneFormulaChangeListener = new UIObserverListener() {
@Override
public void doChange() {
sortPane.update(cellElement);
fireTargetModified();
}
};
private ChangeListener sortTypeBtnGroupChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
sortPane.update(cellElement);
fireTargetModified();
}
};
private UIObserverListener filterPaneChangeListener = new UIObserverListener() {
@Override
public void doChange() {
filterPane.update(cellElement);
fireTargetModified();
}
};
private UIObserverListener customValuePaneChangeListener = new UIObserverListener() {
@Override
public void doChange() {
valuePane.update(cellElement);
fireTargetModified();
}
};
private ChangeListener heCheckBoxChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
cellDSColumnAdvancedPane.updateExtendConfig();
fireTargetModified();
}
};
private ChangeListener veCheckBoxChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
cellDSColumnAdvancedPane.updateExtendConfig();
fireTargetModified();
}
};
private ActionListener useMultiNumCheckBoxChangeListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkButtonEnabled();
cellDSColumnAdvancedPane.updateMultipleConfig();
fireTargetModified();
}
};
private ChangeListener multiNumSpinnerChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
cellDSColumnAdvancedPane.updateMultipleConfig();
fireTargetModified();
}
};
/*listeners end*/
public DSColumnAdvancedEditorPane() { public DSColumnAdvancedEditorPane() {
@ -398,6 +466,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
@Override @Override
public void populate() { public void populate() {
if (cellElement != null) { if (cellElement != null) {
disableListener();
sortPane.populate(cellElement); sortPane.populate(cellElement);
valuePane.populate(cellElement); valuePane.populate(cellElement);
filterPane.populate(cellElement); filterPane.populate(cellElement);
@ -407,6 +476,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
cellElement.setCellExpandAttr(cellExpandAttr); cellElement.setCellExpandAttr(cellExpandAttr);
} }
// extendable // extendable
//noinspection Duplicates
switch (cellExpandAttr.getExtendable()) { switch (cellExpandAttr.getExtendable()) {
case CellExpandAttr.Both_EXTENDABLE: case CellExpandAttr.Both_EXTENDABLE:
heCheckBox.setSelected(true); heCheckBox.setSelected(true);
@ -426,12 +496,15 @@ public class CellDSColumnEditor extends CellQuickEditor {
} }
} }
if (cellExpandAttr.getMultipleNumber() == -1) { if (cellExpandAttr.getMultipleNumber() == -1) {
useMultiplyNumCheckBox.setSelected(false); useMultiNumCheckBox.setSelected(false);
// 默认值
multiNumSpinner.setValue(1);
} else { } else {
useMultiplyNumCheckBox.setSelected(true); useMultiNumCheckBox.setSelected(true);
multiNumSpinner.setValue(cellExpandAttr.getMultipleNumber()); multiNumSpinner.setValue(cellExpandAttr.getMultipleNumber());
} }
this.checkButtonEnabled(); this.checkButtonEnabled();
enableListener();
} }
} }
@ -449,6 +522,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
cellExpandAttr = new CellExpandAttr(); cellExpandAttr = new CellExpandAttr();
cellElement.setCellExpandAttr(cellExpandAttr); cellElement.setCellExpandAttr(cellExpandAttr);
} }
//noinspection Duplicates
if (heCheckBox.isSelected()) { if (heCheckBox.isSelected()) {
if (veCheckBox.isSelected()) { if (veCheckBox.isSelected()) {
cellExpandAttr.setExtendable(CellExpandAttr.Both_EXTENDABLE); cellExpandAttr.setExtendable(CellExpandAttr.Both_EXTENDABLE);
@ -469,12 +543,11 @@ public class CellDSColumnEditor extends CellQuickEditor {
*/ */
private void updateMultipleConfig() { private void updateMultipleConfig() {
CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr();
if (this.useMultiplyNumCheckBox.isSelected()) { if (this.useMultiNumCheckBox.isSelected()) {
cellExpandAttr.setMultipleNumber((int) multiNumSpinner.getValue()); cellExpandAttr.setMultipleNumber((int) multiNumSpinner.getValue());
} else { } else {
cellExpandAttr.setMultipleNumber(-1); cellExpandAttr.setMultipleNumber(-1);
} }
} }
/** /**
@ -485,68 +558,29 @@ public class CellDSColumnEditor extends CellQuickEditor {
@Override @Override
protected JPanel createContentPane() { protected JPanel createContentPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
//结果集排序 //结果集排序
sortPane = new ResultSetSortConfigPane(); sortPane = new ResultSetSortConfigPane();
sortPane.addListener(new UIObserverListener() {
@Override
public void doChange() {
sortPane.update(cellElement);
fireTargetModified();
}
}, new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
sortPane.update(cellElement);
fireTargetModified();
}
}
);
//结果筛选 //结果筛选
filterPane = new ResultSetFilterConfigPane(); filterPane = new ResultSetFilterConfigPane();
filterPane.addListener(new UIObserverListener() {
@Override
public void doChange() {
filterPane.update(cellElement);
fireTargetModified();
}
}
);
//自定义值显示 //自定义值显示
valuePane = new CustomValuePane(); valuePane = new CustomValuePane();
valuePane.addListener(new UIObserverListener() {
@Override
public void doChange() {
valuePane.update(cellElement);
fireTargetModified();
}
});
//可扩展性 //可扩展性
JPanel extendableDirectionPane = FRGUIPaneFactory.createYBoxEmptyBorderPane(); JPanel extendableDirectionPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
extendableDirectionPane.add(heCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Horizontal_Extendable"))); extendableDirectionPane.add(heCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Horizontal_Extendable")));
extendableDirectionPane.add(veCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Vertical_Extendable"))); extendableDirectionPane.add(veCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Vertical_Extendable")));
heCheckBox.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
cellDSColumnAdvancedPane.updateExtendConfig();
fireTargetModified();
}
});
veCheckBox.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
cellDSColumnAdvancedPane.updateExtendConfig();
fireTargetModified();
}
});
JPanel multiNumPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
//补充空白数据 //补充空白数据
useMultiplyNumCheckBox = new UICheckBox(Inter.getLocText("Fill_blank_Data")); JPanel multiNumPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
useMultiNumCheckBox = new UICheckBox(Inter.getLocText("Fill_blank_Data"));
JPanel checkBoxPane = new JPanel(new BorderLayout()); JPanel checkBoxPane = new JPanel(new BorderLayout());
checkBoxPane.add(useMultiplyNumCheckBox, BorderLayout.WEST); checkBoxPane.add(useMultiNumCheckBox, BorderLayout.WEST);
multiNumPane.add(checkBoxPane); multiNumPane.add(checkBoxPane);
multiNumSpinner = new UISpinner(1, 10000, 1, 1); multiNumSpinner = new UISpinner(1, 10000, 1, 1);
//数据倍数 //数据倍数
UILabel multipleLabel = new UILabel(Inter.getLocText("Column_Multiple")); UILabel multipleLabel = new UILabel(Inter.getLocText("Column_Multiple"));
multiPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ multiPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{
@ -557,25 +591,11 @@ public class CellDSColumnEditor extends CellQuickEditor {
); );
multiPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); multiPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
multiNumPane.add(multiPane); multiNumPane.add(multiPane);
useMultiplyNumCheckBox.addActionListener(new ActionListener() {
@Override enableListener();
public void actionPerformed(ActionEvent e) {
checkButtonEnabled();
cellDSColumnAdvancedPane.updateMultipleConfig();
fireTargetModified();
}
});
multiNumSpinner.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
cellDSColumnAdvancedPane.updateMultipleConfig();
fireTargetModified();
}
});
double[] rowSize = {P, P, P, P, P, P}; double[] rowSize = {P, P, P, P, P, P};
double[] columnSize = {F}; double[] columnSize = {F};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
{sortPane}, {sortPane},
{filterPane}, {filterPane},
@ -586,9 +606,29 @@ public class CellDSColumnEditor extends CellQuickEditor {
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP); return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP);
} }
public void enableListener() {
sortPane.addListener(sortPaneFormulaChangeListener, sortTypeBtnGroupChangeListener);
filterPane.addListener(filterPaneChangeListener);
valuePane.addListener(customValuePaneChangeListener);
heCheckBox.addChangeListener(heCheckBoxChangeListener);
veCheckBox.addChangeListener(veCheckBoxChangeListener);
useMultiNumCheckBox.addActionListener(useMultiNumCheckBoxChangeListener);
multiNumSpinner.addChangeListener(multiNumSpinnerChangeListener);
}
public void disableListener() {
sortPane.removeListener(sortTypeBtnGroupChangeListener);
filterPane.removeListener();
valuePane.removeListener();
heCheckBox.removeChangeListener(heCheckBoxChangeListener);
veCheckBox.removeChangeListener(veCheckBoxChangeListener);
useMultiNumCheckBox.removeActionListener(useMultiNumCheckBoxChangeListener);
multiNumSpinner.removeChangeListener(multiNumSpinnerChangeListener);
}
private void checkButtonEnabled() { private void checkButtonEnabled() {
if (useMultiplyNumCheckBox.isSelected()) { if (useMultiNumCheckBox.isSelected()) {
multiNumSpinner.setEnabled(true); multiNumSpinner.setEnabled(true);
multiPane.setVisible(true); multiPane.setVisible(true);
} else { } else {
@ -665,7 +705,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
public void populate(TemplateCellElement cellElement) { public void populate(TemplateCellElement cellElement) {
if (cellElement != null) { if (cellElement != null) {
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (value != null && value instanceof DSColumn) { if (value instanceof DSColumn) {
this.formulaField.populateElement(cellElement); this.formulaField.populateElement(cellElement);
DSColumn dSColumn = (DSColumn) value; DSColumn dSColumn = (DSColumn) value;
int sort = dSColumn.getOrder(); int sort = dSColumn.getOrder();
@ -682,6 +722,8 @@ public class CellDSColumnEditor extends CellQuickEditor {
String sortFormula = dSColumn.getSortFormula(); String sortFormula = dSColumn.getSortFormula();
if (sortFormula != null && sortFormula.length() >= 1) { if (sortFormula != null && sortFormula.length() >= 1) {
this.formulaField.populate(sortFormula); this.formulaField.populate(sortFormula);
} else {
this.formulaField.populate(DEFAULT_VALUE);
} }
} }
} }
@ -695,8 +737,8 @@ public class CellDSColumnEditor extends CellQuickEditor {
public void update(CellElement cellElement) { public void update(CellElement cellElement) {
if (cellElement != null) { if (cellElement != null) {
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (value != null && value instanceof DSColumn) { if (value instanceof DSColumn) {
DSColumn dSColumn = (DSColumn) (cellElement.getValue()); DSColumn dSColumn = (DSColumn) value;
dSColumn.setOrder(this.sortTypePane.getSelectedIndex()); dSColumn.setOrder(this.sortTypePane.getSelectedIndex());
dSColumn.setSortFormula(this.formulaField.getFormulaText()); dSColumn.setSortFormula(this.formulaField.getFormulaText());
} }
@ -713,6 +755,16 @@ public class CellDSColumnEditor extends CellQuickEditor {
formulaField.addListener(formulaChangeListener); formulaField.addListener(formulaChangeListener);
sortTypePane.addChangeListener(changeListener); sortTypePane.addChangeListener(changeListener);
} }
/**
* 去除事件监听器
*
* @param changeListener 排序类型下拉框改动事件监听器
*/
public void removeListener(ChangeListener changeListener) {
formulaField.removeListener();
sortTypePane.removeChangeListener(changeListener);
}
} }
/** /**
@ -858,13 +910,18 @@ public class CellDSColumnEditor extends CellQuickEditor {
rsComboBox.removeActionListener(actionListener); rsComboBox.removeActionListener(actionListener);
if (cellElement != null) { if (cellElement != null) {
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (value != null && value instanceof DSColumn) { if (value instanceof DSColumn) {
DSColumn dSColumn = (DSColumn) (cellElement.getValue()); DSColumn dSColumn = (DSColumn) (cellElement.getValue());
SelectCount selectCount = dSColumn.getSelectCount(); SelectCount selectCount = dSColumn.getSelectCount();
this.topFormulaPane.populateElement(cellElement); this.topFormulaPane.populateElement(cellElement);
this.bottomFormulaPane.populateElement(cellElement); this.bottomFormulaPane.populateElement(cellElement);
CardLayout setCardPaneLayout = (CardLayout) setCardPane.getLayout(); CardLayout setCardPaneLayout = (CardLayout) setCardPane.getLayout();
CardLayout tipCardPaneLayout = (CardLayout) tipCardPane.getLayout(); CardLayout tipCardPaneLayout = (CardLayout) tipCardPane.getLayout();
// 重置默认值
this.topFormulaPane.populate(DEFAULT_VALUE);
this.bottomFormulaPane.populate(DEFAULT_VALUE);
this.serialTextField.setText(StringUtils.EMPTY);
if (selectCount != null) { if (selectCount != null) {
int selectCountType = selectCount.getType(); int selectCountType = selectCount.getType();
this.rsComboBox.setSelectedIndex(selectCountType); this.rsComboBox.setSelectedIndex(selectCountType);
@ -933,6 +990,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0);
} }
} else { } else {
this.rsComboBox.setSelectedIndex(0);
//未定义 //未定义
setCardPaneLayout.show(setCardPane, UNDEFINE.name()); setCardPaneLayout.show(setCardPane, UNDEFINE.name());
tipCardPaneLayout.show(tipCardPane, UNDEFINE.name()); tipCardPaneLayout.show(tipCardPane, UNDEFINE.name());
@ -950,8 +1008,8 @@ public class CellDSColumnEditor extends CellQuickEditor {
public void update(CellElement cellElement) { public void update(CellElement cellElement) {
if (cellElement != null) { if (cellElement != null) {
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (value != null && value instanceof DSColumn) { if (value instanceof DSColumn) {
DSColumn dSColumn = (DSColumn) (cellElement.getValue()); DSColumn dSColumn = (DSColumn) value;
int selectedFilterIndex = this.rsComboBox.getSelectedIndex(); int selectedFilterIndex = this.rsComboBox.getSelectedIndex();
if (selectedFilterIndex == 0) { if (selectedFilterIndex == 0) {
dSColumn.setSelectCount(null); dSColumn.setSelectCount(null);
@ -959,6 +1017,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
SelectCount selectCount = new SelectCount(); SelectCount selectCount = new SelectCount();
selectCount.setType(selectedFilterIndex); selectCount.setType(selectedFilterIndex);
dSColumn.setSelectCount(selectCount); dSColumn.setSelectCount(selectCount);
//noinspection Duplicates
if (selectedFilterIndex == TOP.getValue()) { if (selectedFilterIndex == TOP.getValue()) {
selectCount.setFormulaCount(this.topFormulaPane.getFormulaText()); selectCount.setFormulaCount(this.topFormulaPane.getFormulaText());
} else if (selectedFilterIndex == BOTTOM.getValue()) { } else if (selectedFilterIndex == BOTTOM.getValue()) {
@ -982,6 +1041,16 @@ public class CellDSColumnEditor extends CellQuickEditor {
rsComboBox.registerChangeListener(formulaListener); rsComboBox.registerChangeListener(formulaListener);
serialTextField.registerChangeListener(formulaListener); serialTextField.registerChangeListener(formulaListener);
} }
/**
* 去除事件监听器
*/
public void removeListener() {
topFormulaPane.removeListener();
bottomFormulaPane.removeListener();
rsComboBox.removeChangeListener();
serialTextField.registerChangeListener(null);
}
} }
/** /**
@ -1035,6 +1104,13 @@ public class CellDSColumnEditor extends CellQuickEditor {
this.formulaTextField.registerChangeListener(listener); this.formulaTextField.registerChangeListener(listener);
} }
/**
* 取消事件监听器
*/
public void removeListener() {
this.formulaTextField.registerChangeListener(null);
}
private ActionListener formulaButtonActionListener = new ActionListener() { private ActionListener formulaButtonActionListener = new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
@ -1048,7 +1124,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
final UIFormula formulaPane = FormulaFactory.createFormulaPaneWhenReserveFormula(); final UIFormula formulaPane = FormulaFactory.createFormulaPaneWhenReserveFormula();
if (cellElement != null) { if (cellElement != null) {
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (value != null && value instanceof DSColumn) { if (value instanceof DSColumn) {
DSColumn dsColumn = (DSColumn) value; DSColumn dsColumn = (DSColumn) value;
String[] displayNames = DesignTableDataManager.getSelectedColumnNames(DesignTableDataManager.getEditingTableDataSource(), dsColumn.getDSName()); String[] displayNames = DesignTableDataManager.getSelectedColumnNames(DesignTableDataManager.getEditingTableDataSource(), dsColumn.getDSName());
formulaPane.populate(valueFormula, new CustomVariableResolver(displayNames, true)); formulaPane.populate(valueFormula, new CustomVariableResolver(displayNames, true));
@ -1092,12 +1168,14 @@ public class CellDSColumnEditor extends CellQuickEditor {
public void populate(CellElement cellElement) { public void populate(CellElement cellElement) {
if (cellElement != null) { if (cellElement != null) {
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (value != null && value instanceof DSColumn) { if (value instanceof DSColumn) {
DSColumn dSColumn = (DSColumn) value; DSColumn dSColumn = (DSColumn) value;
//formula //formula
String valueFormula = dSColumn.getResult(); String valueFormula = dSColumn.getResult();
if (valueFormula != null) { if (valueFormula != null) {
formulaField.populate(valueFormula); formulaField.populate(valueFormula);
} else {
formulaField.populate(DEFAULT_VALUE);
} }
formulaField.populateElement(cellElement); formulaField.populateElement(cellElement);
@ -1108,7 +1186,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
public void update(CellElement cellElement) { public void update(CellElement cellElement) {
if (cellElement != null) { if (cellElement != null) {
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (value != null && value instanceof DSColumn) { if (value instanceof DSColumn) {
DSColumn dSColumn = (DSColumn) (cellElement.getValue()); DSColumn dSColumn = (DSColumn) (cellElement.getValue());
dSColumn.setResult(this.formulaField.getFormulaText()); dSColumn.setResult(this.formulaField.getFormulaText());
} }
@ -1123,6 +1201,13 @@ public class CellDSColumnEditor extends CellQuickEditor {
public void addListener(UIObserverListener formulaListener) { public void addListener(UIObserverListener formulaListener) {
this.formulaField.addListener(formulaListener); this.formulaField.addListener(formulaListener);
} }
/**
* 移除事件监听器
*/
public void removeListener() {
this.formulaField.removeListener();
}
} }
} }

17
designer/src/com/fr/start/ReportSplashPane.java

@ -15,8 +15,13 @@ import com.fr.stable.StringUtils;
import com.fr.stable.module.ModuleAdapter; import com.fr.stable.module.ModuleAdapter;
import com.fr.stable.module.ModuleListener; import com.fr.stable.module.ModuleListener;
import javax.swing.*; import javax.swing.Icon;
import java.awt.*; import javax.swing.ImageIcon;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.util.Locale; import java.util.Locale;
import java.util.Random; import java.util.Random;
import java.util.TimerTask; import java.util.TimerTask;
@ -68,6 +73,7 @@ public class ReportSplashPane extends SplashPane {
this.setBackground(null); this.setBackground(null);
timer.schedule(new TimerTask() { timer.schedule(new TimerTask() {
@Override
public void run() { public void run() {
loadingIndex++; loadingIndex++;
ReportSplashPane.this.setShowText(moduleID.isEmpty() ? StringUtils.EMPTY : moduleID + loading[loadingIndex % 3]); ReportSplashPane.this.setShowText(moduleID.isEmpty() ? StringUtils.EMPTY : moduleID + loading[loadingIndex % 3]);
@ -87,6 +93,7 @@ public class ReportSplashPane extends SplashPane {
ModuleContext.registerModuleListener(moduleListener); ModuleContext.registerModuleListener(moduleListener);
} }
@Override
protected void paintComponent(Graphics g) { protected void paintComponent(Graphics g) {
Icon icon = IconLoader.getIcon(StableUtils.pathJoin(OEM_PATH, getImageName())); Icon icon = IconLoader.getIcon(StableUtils.pathJoin(OEM_PATH, getImageName()));
icon.paintIcon(null, g, 0, 0); icon.paintIcon(null, g, 0, 0);
@ -94,16 +101,18 @@ public class ReportSplashPane extends SplashPane {
g.dispose(); g.dispose();
} }
@Override
public void setShowText(String text) { public void setShowText(String text) {
this.showText = text; this.showText = text;
} }
@Override
public Image getSplashImage() { public Image getSplashImage() {
Icon icon = IconLoader.getIcon(StableUtils.pathJoin(OEM_PATH, getImageName())); Icon icon = IconLoader.getIcon(StableUtils.pathJoin(OEM_PATH, getImageName()));
return ((ImageIcon) IconLoader.getIconSnapshot(icon)).getImage(); return ((ImageIcon) IconLoader.getIconSnapshot(icon)).getImage();
} }
private void paintShowText(Graphics2D splashG2d) { protected void paintShowText(Graphics2D splashG2d) {
GraphHelper.applyRenderingHints(splashG2d); GraphHelper.applyRenderingHints(splashG2d);
splashG2d.setPaint(MODULE_COLOR); splashG2d.setPaint(MODULE_COLOR);
@ -160,6 +169,7 @@ public class ReportSplashPane extends SplashPane {
/** /**
* 窗口关闭后取消定时获取模块信息的timer * 窗口关闭后取消定时获取模块信息的timer
*/ */
@Override
public void releaseTimer() { public void releaseTimer() {
timer.cancel(); timer.cancel();
} }
@ -169,6 +179,7 @@ public class ReportSplashPane extends SplashPane {
* *
* @return 背景图片 * @return 背景图片
*/ */
@Override
public Image createSplashBackground() { public Image createSplashBackground() {
String fileName = getImageName(); String fileName = getImageName();
return BaseUtils.readImage(StableUtils.pathJoin(OEM_PATH, fileName)); return BaseUtils.readImage(StableUtils.pathJoin(OEM_PATH, fileName));

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

@ -148,6 +148,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private boolean isHttps = false; private boolean isHttps = false;
private static List<SwingWorker> mapWorkerList = new ArrayList<SwingWorker>(); private static List<SwingWorker> mapWorkerList = new ArrayList<SwingWorker>();
private boolean imageCompress = true;//图片压缩
/** /**
* DesignerEnvManager. * DesignerEnvManager.
@ -1414,6 +1415,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.setOracleSystemSpace(reader.getAttrAsBoolean("useOracleSystemSpace", true)); this.setOracleSystemSpace(reader.getAttrAsBoolean("useOracleSystemSpace", true));
this.setCachingTemplateLimit(reader.getAttrAsInt("cachingTemplateLimit", CACHINGTEMPLATE_LIMIT)); this.setCachingTemplateLimit(reader.getAttrAsInt("cachingTemplateLimit", CACHINGTEMPLATE_LIMIT));
this.setJoinProductImprove(reader.getAttrAsBoolean("joinProductImprove", true)); this.setJoinProductImprove(reader.getAttrAsBoolean("joinProductImprove", true));
this.setImageCompress(reader.getAttrAsBoolean("imageCompress", true));
this.setAutoBackUp(reader.getAttrAsBoolean("autoBackUp", true)); this.setAutoBackUp(reader.getAttrAsBoolean("autoBackUp", true));
this.setTemplateTreePaneExpanded(reader.getAttrAsBoolean("templateTreePaneExpanded", false)); this.setTemplateTreePaneExpanded(reader.getAttrAsBoolean("templateTreePaneExpanded", false));
// peter:读取webinfLocation // peter:读取webinfLocation
@ -1639,6 +1641,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if (!this.isJoinProductImprove()) { if (!this.isJoinProductImprove()) {
writer.attr("joinProductImprove", this.isJoinProductImprove()); writer.attr("joinProductImprove", this.isJoinProductImprove());
} }
if (!this.isImageCompress()) {
writer.attr("imageCompress", this.isImageCompress());
}
if (!this.isAutoBackUp()) { if (!this.isAutoBackUp()) {
writer.attr("autoBackUp", this.isAutoBackUp()); writer.attr("autoBackUp", this.isAutoBackUp());
} }
@ -1812,4 +1817,12 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
public void setAlphaFineConfigManager(AlphaFineConfigManager alphaFineConfigManager) { public void setAlphaFineConfigManager(AlphaFineConfigManager alphaFineConfigManager) {
this.alphaFineConfigManager = alphaFineConfigManager; this.alphaFineConfigManager = alphaFineConfigManager;
} }
public boolean isImageCompress() {
return imageCompress;
}
public void setImageCompress(boolean imageCompress) {
this.imageCompress = imageCompress;
}
} }

11
designer_base/src/com/fr/design/editor/editor/ColumnRowEditor.java

@ -4,12 +4,12 @@ import com.fr.design.gui.columnrow.ColumnRowPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.stable.ColumnRow; import com.fr.stable.ColumnRow;
import java.awt.*; import java.awt.BorderLayout;
/** /**
* the editor to edit ColumnRow * the editor to edit ColumnRow
* *
* @editor zhou * @author zhou
* @since 2012-3-29下午6:01:37 * @since 2012-3-29下午6:01:37
*/ */
public class ColumnRowEditor extends Editor<ColumnRow> { public class ColumnRowEditor extends Editor<ColumnRow> {
@ -63,6 +63,7 @@ public class ColumnRowEditor extends Editor<ColumnRow> {
this.crPane.requestFocus(); this.crPane.requestFocus();
} }
@Override
public String getIconName() { public String getIconName() {
return "cell"; return "cell";
} }
@ -71,4 +72,10 @@ public class ColumnRowEditor extends Editor<ColumnRow> {
public boolean accept(Object object) { public boolean accept(Object object) {
return object instanceof ColumnRow; return object instanceof ColumnRow;
} }
@Override
public void clearData() {
super.clearData();
this.setValue(null);
}
} }

34
designer_base/src/com/fr/design/editor/editor/TextEditor.java

@ -3,26 +3,31 @@
*/ */
package com.fr.design.editor.editor; package com.fr.design.editor.editor;
import java.awt.BorderLayout;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.awt.BorderLayout;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
/** /**
* CellEditor used to edit String object. * CellEditor used to edit String object.
* *
* @editor zhou * @author zhou
* @since 2012-3-29下午6:00:43 * @since 2012-3-29下午6:00:43
*/ */
public class TextEditor extends Editor<String> { public class TextEditor extends Editor<String> {
private UITextField textField; // text field. /**
// the old value of text field. * text field.
*/
private UITextField textField;
/**
* the old value of text field.
*/
private String oldValue = StringUtils.EMPTY; private String oldValue = StringUtils.EMPTY;
/** /**
@ -93,7 +98,7 @@ public class TextEditor extends Editor<String> {
value = StringUtils.EMPTY; value = StringUtils.EMPTY;
} }
oldValue = value.toString(); oldValue = value;
this.textField.setText(oldValue); this.textField.setText(oldValue);
} }
@ -110,6 +115,7 @@ public class TextEditor extends Editor<String> {
/** /**
* 请求焦点 * 请求焦点
*/ */
@Override
public void requestFocus() { public void requestFocus() {
this.textField.requestFocus(); this.textField.requestFocus();
} }
@ -133,10 +139,12 @@ public class TextEditor extends Editor<String> {
/** /**
* 被选中时文本输入框请求焦点 * 被选中时文本输入框请求焦点
*/ */
@Override
public void selected() { public void selected() {
this.textField.requestFocus(); this.textField.requestFocus();
} }
@Override
public String getIconName() { public String getIconName() {
return "type_string"; return "type_string";
} }
@ -147,7 +155,15 @@ public class TextEditor extends Editor<String> {
* @param object 需要判断的object * @param object 需要判断的object
* @return 是字符类型则返回true * @return 是字符类型则返回true
*/ */
@Override
public boolean accept(Object object) { public boolean accept(Object object) {
return object instanceof String; return object instanceof String;
} }
@Override
public void clearData() {
super.clearData();
this.textField.setText(StringUtils.EMPTY);
this.oldValue = StringUtils.EMPTY;
}
} }

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

@ -21,11 +21,10 @@ import java.awt.geom.Rectangle2D;
public abstract class NewTemplatePane extends JComponent implements MouseListener, MouseMotionListener { public abstract class NewTemplatePane extends JComponent implements MouseListener, MouseMotionListener {
private static final Icon GRAY_NEW_CPT = BaseUtils.readIcon("/com/fr/design/images/buttonicon/additicon_grey.png"); private static final Icon GRAY_NEW_CPT = BaseUtils.readIcon("/com/fr/design/images/buttonicon/additicon_grey.png");
private static final int PRE_GAP = 5; private static final int ICON_START_X = 5;
private static final int HEIGHT = 26; private static final int HEIGHT = 26;
private Graphics2D g2d; private Graphics2D g2d;
private Icon newWorkBookIconMode = null; private Icon newWorkBookIconMode = null;
private int newIconStartX = PRE_GAP;
public NewTemplatePane() { public NewTemplatePane() {
@ -50,7 +49,7 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene
g2d.setColor(UIConstants.TEMPLATE_TAB_PANE_BACKGROUND); g2d.setColor(UIConstants.TEMPLATE_TAB_PANE_BACKGROUND);
g2d.fill(new Rectangle2D.Double(0, 0, getWidth(),getHeight())); g2d.fill(new Rectangle2D.Double(0, 0, getWidth(),getHeight()));
int sheetIconY = (getHeight() - newWorkBookIconMode.getIconHeight()) / 2; int sheetIconY = (getHeight() - newWorkBookIconMode.getIconHeight()) / 2;
newWorkBookIconMode.paintIcon(this, g2d, newIconStartX, sheetIconY); newWorkBookIconMode.paintIcon(this, g2d, ICON_START_X, sheetIconY);
// paintUnderLine(g2d); // paintUnderLine(g2d);
} }
@ -82,7 +81,6 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene
} }
if (isOverNewIcon(evtX) && newWorkBookIconMode != GRAY_NEW_CPT) { if (isOverNewIcon(evtX) && newWorkBookIconMode != GRAY_NEW_CPT) {
newWorkBookIconMode = getMousePressNew(); newWorkBookIconMode = getMousePressNew();
newIconStartX = 0;
DesignerContext.getDesignerFrame().addAndActivateJTemplate(); DesignerContext.getDesignerFrame().addAndActivateJTemplate();
} }
this.repaint(); this.repaint();
@ -113,7 +111,6 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene
* @param e 事件 * @param e 事件
*/ */
public void mouseExited(MouseEvent e) { public void mouseExited(MouseEvent e) {
newIconStartX = PRE_GAP;
if (needGrayNewCpt()) { if (needGrayNewCpt()) {
newWorkBookIconMode = GRAY_NEW_CPT; newWorkBookIconMode = GRAY_NEW_CPT;
} else { } else {
@ -139,7 +136,6 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene
if (needGrayNewCpt()) { if (needGrayNewCpt()) {
newWorkBookIconMode = GRAY_NEW_CPT; newWorkBookIconMode = GRAY_NEW_CPT;
} else if (isOverNewIcon(evtX)) { } else if (isOverNewIcon(evtX)) {
newIconStartX = 0;
newWorkBookIconMode = getMouseOverNew(); newWorkBookIconMode = getMouseOverNew();
} }
@ -153,7 +149,7 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene
private boolean isOverNewIcon(int evtX) { private boolean isOverNewIcon(int evtX) {
return (evtX >= PRE_GAP && evtX <= PRE_GAP + newWorkBookIconMode.getIconWidth()); return (evtX >= ICON_START_X && evtX <= ICON_START_X + newWorkBookIconMode.getIconWidth());
} }
public void setButtonGray(boolean isGray) { public void setButtonGray(boolean isGray) {

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

@ -17,10 +17,34 @@ import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import javax.swing.border.EmptyBorder; import javax.swing.border.EmptyBorder;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.event.*; import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GraphicsEnvironment;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.Window;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
/** /**
* Created by plough on 2017/7/21. * Created by plough on 2017/7/21.
@ -47,7 +71,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
} }
public UIControlPane(BasePlot plot) { public UIControlPane(BasePlot plot) {
this.plot =plot; this.plot = plot;
this.initComponentPane(); this.initComponentPane();
} }
@ -145,7 +169,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
this.checkButtonEnabled(); this.checkButtonEnabled();
} }
protected void getPopupEditDialog (JPanel cardPane) { protected void getPopupEditDialog(JPanel cardPane) {
popupEditDialog = new PopupEditDialog(cardPane); popupEditDialog = new PopupEditDialog(cardPane);
} }
@ -169,7 +193,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
toolbarDef.addShortCut(sj.getShortCut()); toolbarDef.addShortCut(sj.getShortCut());
} }
toolBar = ToolBarDef.createJToolBar(); toolBar = ToolBarDef.createJToolBar();
toolBar.setUI(new UIToolBarUI(){ toolBar.setUI(new UIToolBarUI() {
@Override @Override
public void paint(Graphics g, JComponent c) { public void paint(Graphics g, JComponent c) {
Graphics2D g2 = (Graphics2D) g; Graphics2D g2 = (Graphics2D) g;
@ -186,7 +210,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
leftContentPane.add(toolBarPane, BorderLayout.NORTH); leftContentPane.add(toolBarPane, BorderLayout.NORTH);
// 顶部标签及add按钮 // 顶部标签及add按钮
topToolBar = new UIToolbar(FlowLayout.LEFT, new UIToolBarUI(){ topToolBar = new UIToolbar(FlowLayout.LEFT, new UIToolBarUI() {
@Override @Override
public void paint(Graphics g, JComponent c) { public void paint(Graphics g, JComponent c) {
Graphics2D g2 = (Graphics2D) g; Graphics2D g2 = (Graphics2D) g;
@ -207,15 +231,15 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
return leftPane; return leftPane;
} }
protected JPanel getLeftTopPane (UIToolbar topToolBar) { protected JPanel getLeftTopPane(UIToolbar topToolBar) {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = { p, f, isNewStyle() ? TOP_TOOLBAR_WIDTH : TOP_TOOLBAR_WIDTH_SHORT}; double[] columnSize = {p, f, isNewStyle() ? TOP_TOOLBAR_WIDTH : TOP_TOOLBAR_WIDTH_SHORT};
double[] rowSize = {TOP_TOOLBAR_HEIGHT}; double[] rowSize = {TOP_TOOLBAR_HEIGHT};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(getAddItemText()), new JPanel(), topToolBar}, new Component[]{new UILabel(getAddItemText()), new JPanel(), topToolBar},
}; };
return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
} }
/** /**
@ -336,6 +360,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
initListener(); initListener();
} }
@Override
public void setTitle(String title) { public void setTitle(String title) {
popupToolPane.setTitle(title); popupToolPane.setTitle(title);
} }
@ -349,10 +374,21 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
} }
// 如果有可见模态对话框,则不隐藏 // 如果有可见模态对话框,则不隐藏
for (Window window : DesignerContext.getDesignerFrame().getOwnedWindows()) { for (Window window : DesignerContext.getDesignerFrame().getOwnedWindows()) {
if (window instanceof JDialog && window.isVisible() && ((JDialog)window).isModal()) { if (window instanceof JDialog && window.isVisible() && ((JDialog) window).isModal()) {
return; return;
} }
} }
// 要隐藏 先检查有没有非法输入
// 非法输入检查放在最后,因为可能出现面板弹出新弹框而失去焦点的情况,比如 输入公式时,弹出公式编辑对话框
try {
checkValid();
} catch (Exception exp) {
// 存在非法输入 拒绝隐藏
JOptionPane.showMessageDialog(UIControlPane.this.controlUpdatePane, exp.getMessage());
this.requestFocus();
return;
}
saveSettings(); saveSettings();
setVisible(false); setVisible(false);
} }
@ -361,7 +397,6 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
addWindowFocusListener(new WindowAdapter() { addWindowFocusListener(new WindowAdapter() {
@Override @Override
public void windowLostFocus(WindowEvent e) { public void windowLostFocus(WindowEvent e) {
super.windowLostFocus(e);
hideDialog(); hideDialog();
} }
}); });
@ -389,6 +424,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
} }
repaint(); repaint();
} }
@Override @Override
public void mouseReleased(MouseEvent e) { public void mouseReleased(MouseEvent e) {
mouseDownCompCoords = null; mouseDownCompCoords = null;
@ -396,6 +432,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
contentPane.setBackground(originColor); contentPane.setBackground(originColor);
} }
} }
@Override @Override
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
mouseDownCompCoords = e.getPoint(); mouseDownCompCoords = e.getPoint();
@ -409,6 +446,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
contentPane.setBackground(UIConstants.POPUP_TITLE_BACKGROUND); contentPane.setBackground(UIConstants.POPUP_TITLE_BACKGROUND);
repaint(); repaint();
} }
@Override @Override
public void mouseDragged(MouseEvent e) { public void mouseDragged(MouseEvent e) {
if (mouseDownCompCoords != null) { if (mouseDownCompCoords != null) {

122
designer_base/src/com/fr/design/gui/frpane/ImgChoosePane.java

@ -1,122 +0,0 @@
package com.fr.design.gui.frpane;
import com.fr.base.BaseUtils;
import com.fr.base.background.ImageBackground;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.style.background.image.ImageFileChooser;
import com.fr.design.style.background.image.ImagePreviewPane;
import com.fr.general.Inter;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
public class ImgChoosePane extends BasicPane {
private ImagePreviewPane previewPane;
private UIButton chooseButton;
private UIButton clearButton;
private UILabel imgSizeLabel;
private ImageFileChooser imageFileChooser;
public ImgChoosePane() {
this.initComponents();
}
protected void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel previewContainner = new JPanel();
previewContainner.setBorder(BorderFactory.createTitledBorder(Inter.getLocText("Preview")));
previewPane = new ImagePreviewPane();
previewContainner.add(previewPane);
previewPane.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent evt) {
Image image = ((ImagePreviewPane) evt.getSource()).getImage();
if (image == null) {
imgSizeLabel.setText("");
} else {
// imgSizeLabel.setText(Inter.getLocText("Size") + ": " + image.getWidth(null) + "px"
// + image.getHeight(null) + Inter.getLocText("px"));
imgSizeLabel.setText(Inter.getLocText(new String[]{"Size", "px", "px"},
new String[]{": " + image.getWidth(null), image.getHeight(null) + ""}));
}
}
});
this.add(previewContainner, BorderLayout.CENTER);
JPanel choosePane = new JPanel(new BorderLayout(0, 10));
choosePane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
JPanel choosePane1 = new JPanel(new BorderLayout(0, 10));
initButton();
choosePane.add(chooseButton, BorderLayout.NORTH);
choosePane1.add(clearButton,BorderLayout.NORTH);
choosePane.add(choosePane1,BorderLayout.CENTER);
imgSizeLabel = new UILabel();
imgSizeLabel.setHorizontalAlignment(SwingConstants.CENTER);
choosePane1.add(imgSizeLabel,BorderLayout.CENTER);
this.add(choosePane,BorderLayout.EAST);
imageFileChooser = new ImageFileChooser();
}
private void initButton() {
chooseButton = new UIButton(Inter.getLocText("Image-Select_Picture"));
chooseButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
int returnVal = imageFileChooser.showOpenDialog(ImgChoosePane.this);
if (returnVal != JFileChooser.CANCEL_OPTION) {
File selectedFile = imageFileChooser.getSelectedFile();
if (selectedFile != null && selectedFile.isFile()) {
Image image = BaseUtils.readImage(selectedFile.getPath());
previewPane.setImage(image);
previewPane.repaint();
} else {
previewPane.setImage(null);
}
}
}
});
clearButton = new UIButton(Inter.getLocText("Clear"));
clearButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
previewPane.setImage(null);
previewPane.repaint();
}
});
}
public void populate(ImageBackground background) {
if(background != null && background.getImage() != null) {
previewPane.setImage(background.getImage());
}
}
public ImageBackground update() {
if(previewPane.getImage() == null) {
return null;
}
return new ImageBackground(previewPane.getImage());
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("Image");
}
}

145
designer_base/src/com/fr/design/gui/frpane/ImgChooseWrapper.java

@ -0,0 +1,145 @@
package com.fr.design.gui.frpane;
import com.fr.base.BaseUtils;
import com.fr.base.Style;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.style.background.image.ImageFileChooser;
import com.fr.design.style.background.image.ImagePreviewer;
import com.fr.design.utils.ImageUtils;
import com.fr.general.Inter;
import com.fr.stable.CoreGraphHelper;
import com.fr.stable.StringUtils;
import javax.swing.JFileChooser;
import javax.swing.SwingWorker;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.Image;
import java.io.File;
/**
* 图片选择框包装类
* Created by zack on 2018/3/9.
*/
public class ImgChooseWrapper {
private ImagePreviewer previewPane = null;
private ImageFileChooser imageFileChooser = null;
private Style imageStyle = null;
private SwingWorker<Void, Void> imageWorker;
private ChangeListener changeListener;
private transient Image selectImage;
private UILabel imageSizeLabel;
public static ImgChooseWrapper getInstance(ImagePreviewer previewPane, ImageFileChooser imageFileChooser, Style imageStyle) {
return getInstance(previewPane, imageFileChooser, imageStyle, null);
}
public static ImgChooseWrapper getInstance(ImagePreviewer previewPane, ImageFileChooser imageFileChooser, Style imageStyle, ChangeListener changeListener) {
return new ImgChooseWrapper(previewPane, imageFileChooser, imageStyle, changeListener, null, null);
}
public static ImgChooseWrapper getInstance(Image selectImage, UILabel imageSizeLabel, ImageFileChooser imageFileChooser) {
return new ImgChooseWrapper(null, imageFileChooser, null, null, selectImage, imageSizeLabel);
}
private ImgChooseWrapper(ImagePreviewer previewPane, ImageFileChooser imageFileChooser, Style imageStyle, ChangeListener changeListener, Image selectImage, UILabel imageSizeLabel) {
this.previewPane = previewPane;
this.imageFileChooser = imageFileChooser;
this.imageStyle = imageStyle;
this.changeListener = changeListener;
this.selectImage = selectImage;
this.imageSizeLabel = imageSizeLabel;
}
public void setPreviewPane(ImagePreviewer previewPane) {
this.previewPane = previewPane;
}
public ImageFileChooser getImageFileChooser() {
return imageFileChooser;
}
public void setImageFileChooser(ImageFileChooser imageFileChooser) {
this.imageFileChooser = imageFileChooser;
}
public Style getImageStyle() {
return imageStyle;
}
public void setImageStyle(Style imageStyle) {
this.imageStyle = imageStyle;
}
public SwingWorker<Void, Void> getImageWorker() {
return imageWorker;
}
public void setImageWorker(SwingWorker<Void, Void> imageWorker) {
this.imageWorker = imageWorker;
}
public void dealWithImageFile(int returnVal) {
if (returnVal != JFileChooser.CANCEL_OPTION) {
final File selectedFile = imageFileChooser.getSelectedFile();
if (selectedFile != null && selectedFile.isFile()) {
if (previewPane != null) {
previewPane.showLoading();
}
if (imageWorker != null && !imageWorker.isDone()) {
imageWorker = null;
}
imageWorker = new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
Image image = imageFileChooser.isCheckSelected() ? ImageUtils.defaultImageCompress(selectedFile) : BaseUtils.readImage(selectedFile.getPath());
CoreGraphHelper.waitForImage(image);
if (previewPane != null) {
previewPane.setImageStyle(imageStyle);
previewPane.setImage(image);
previewPane.repaint();
}
checkLabelText();
fireChangeListener();
return null;
}
};
imageWorker.execute();
} else {
if (previewPane != null) {
previewPane.setImage(null);
}
}
if (previewPane != null) {
previewPane.repaint();
}
}
}
private void fireChangeListener() {
if (this.changeListener != null) {
ChangeEvent evt = new ChangeEvent(this);
this.changeListener.stateChanged(evt);
}
}
private void checkLabelText() {
if (imageSizeLabel == null) {
return;
}
if (selectImage == null) {
imageSizeLabel.setText(StringUtils.EMPTY);
} else {
imageSizeLabel.setText(selectImage.getWidth(null) + "x"
+ selectImage.getHeight(null) + Inter.getLocText("px"));
}
}
}

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

@ -1,6 +1,14 @@
package com.fr.design.gui.ibutton; package com.fr.design.gui.ibutton;
import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
/** /**
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
@ -9,38 +17,110 @@ import javax.swing.*;
* Date: 13-3-27 * Date: 13-3-27
* Time: 下午5:04 * Time: 下午5:04
*/ */
public class UIRadioButton extends JRadioButton { public class UIRadioButton extends JRadioButton implements UIObserver, GlobalNameObserver {
private UIObserverListener uiObserverListener;
private GlobalNameListener globalNameListener = null;
private String radioButtonName = StringUtils.EMPTY;
public UIRadioButton() { public UIRadioButton() {
super(); super();
initListener();
} }
public UIRadioButton(Icon icon) { public UIRadioButton(Icon icon) {
super(icon); super(icon);
initListener();
} }
public UIRadioButton(Action a) { public UIRadioButton(Action a) {
super(a); super(a);
initListener();
} }
public UIRadioButton(Icon icon, boolean selected) { public UIRadioButton(Icon icon, boolean selected) {
super(icon, selected); super(icon, selected);
initListener();
} }
public UIRadioButton(String text) { public UIRadioButton(String text) {
super(text); super(text);
initListener();
} }
public UIRadioButton(String text, boolean selected) { public UIRadioButton(String text, boolean selected) {
super(text, selected); super(text, selected);
initListener();
} }
public UIRadioButton(String text, Icon icon) { public UIRadioButton(String text, Icon icon) {
super(text, icon); super(text, icon);
initListener();
} }
public UIRadioButton(String text, Icon icon, boolean selected) { public UIRadioButton(String text, Icon icon, boolean selected) {
super(text, icon, selected); super(text, icon, selected);
initListener();
}
private void initListener() {
if (shouldResponseChangeListener()) {
this.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (uiObserverListener == null || e.getStateChange() != ItemEvent.SELECTED) {
return;
}
if (globalNameListener != null && shouldResponseNameListener()) {
globalNameListener.setGlobalName(radioButtonName);
}
uiObserverListener.doChange();
}
});
}
}
/**
* 给组件登记一个观察者监听事件
*
* @param listener 观察者监听事件
*/
public void registerChangeListener(UIObserverListener listener) {
this.uiObserverListener = listener;
}
public void setGlobalName(String name) {
radioButtonName = name;
}
public String getGlobalName() {
return radioButtonName;
}
/**
* 组件是否需要响应添加的观察者事件
*
* @return 如果需要响应观察者事件则返回true否则返回false
*/
public boolean shouldResponseChangeListener() {
return true;
}
/**
* 注册观察者监听事件
* @param listener 观察者监听事件
*/
public void registerNameListener(GlobalNameListener listener) {
globalNameListener = listener;
}
/**
* 组件是否需要响应观察者事件
* @return 如果需要响应观察者事件则返回true否则返回false
*/
public boolean shouldResponseNameListener() {
return true;
} }
} }

2
designer_base/src/com/fr/design/gui/ilable/UILabel.java

@ -3,6 +3,7 @@ package com.fr.design.gui.ilable;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.StringUtils;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JLabel; import javax.swing.JLabel;
@ -63,6 +64,7 @@ public class UILabel extends JLabel {
return preferredSize; return preferredSize;
} }
public static void main(String[] args) { public static void main(String[] args) {
// UILabel label = new UILabel("shishi",SwingConstants.LEFT); // UILabel label = new UILabel("shishi",SwingConstants.LEFT);
JFrame frame = new JFrame("Test"); JFrame frame = new JFrame("Test");

BIN
designer_base/src/com/fr/design/images/control/newEdit.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 442 B

After

Width:  |  Height:  |  Size: 314 B

31
designer_base/src/com/fr/design/layout/FRGUIPaneFactory.java

@ -416,6 +416,37 @@ public class FRGUIPaneFactory {
return jp; return jp;
} }
/**
* 创建垂直流布局面板
*
* @param isAlignLeft 是否左对齐
* @return JPanel对象
*/
public static JPanel createVerticalFlowLayout_S_Pane(boolean isAlignLeft) {
JPanel jp = new JPanel();
VerticalFlowLayout layout = new VerticalFlowLayout();
layout.setAlignLeft(isAlignLeft);
jp.setLayout(layout);
return jp;
}
/**
* 创建垂直流布局面板
*
* @param isAlignLeft 是否左对齐
* @param align the alignment value
* @param hgap the horizontal gap between components
* @param vgap the vertical gap between components
* @return JPanel对象
*/
public static JPanel createVerticalFlowLayout_Pane(boolean isAlignLeft, int align, int hgap, int vgap) {
JPanel jp = new JPanel();
VerticalFlowLayout layout = new VerticalFlowLayout(align, hgap, vgap);
layout.setAlignLeft(isAlignLeft);
jp.setLayout(layout);
return jp;
}
/** /**
* 创建边框面板L * 创建边框面板L
* *

15
designer_base/src/com/fr/design/layout/VerticalFlowLayout.java

@ -71,6 +71,9 @@ public class VerticalFlowLayout implements LayoutManager, java.io.Serializable {
*/ */
int newAlign; // This is the one we actually use int newAlign; // This is the one we actually use
// 当列宽不一致时,是否需要左对齐(默认居中对齐)
boolean isAlignLeft = false;
/** /**
* The flow layout manager allows a seperation of * The flow layout manager allows a seperation of
* components with gaps. The horizontal gap will * components with gaps. The horizontal gap will
@ -345,10 +348,11 @@ public class VerticalFlowLayout implements LayoutManager, java.io.Serializable {
for (int i = rowStart; i < rowEnd; i++) { for (int i = rowStart; i < rowEnd; i++) {
Component m = target.getComponent(i); Component m = target.getComponent(i);
if (m.isVisible()) { if (m.isVisible()) {
int newX = x + (width - m.getWidth()) / 2;
if (ltr) { if (ltr) {
m.setLocation(x + (width - m.getWidth()) / 2, y); m.setLocation(isAlignLeft ? x : newX, y);
} else { } else {
m.setLocation(x + (width - m.getWidth()) / 2, target.getHeight() - y - m.getHeight()); m.setLocation(isAlignLeft ? x : newX, target.getHeight() - y - m.getHeight());
} }
y += m.getHeight() + vgap; y += m.getHeight() + vgap;
} }
@ -431,6 +435,13 @@ public class VerticalFlowLayout implements LayoutManager, java.io.Serializable {
return 0; return 0;
} }
/**
* 当列宽不一致时通过此方法设置是否需要左对齐
*/
public void setAlignLeft(boolean isAlignLeft) {
this.isAlignLeft = true;
}
/** /**
* Returns a string representation of this <code>FlowLayout</code> * Returns a string representation of this <code>FlowLayout</code>

26
designer_base/src/com/fr/design/locale/designer.properties

@ -1652,7 +1652,7 @@ Parameter_Setting=Parameter Setting
Related=Related Related=Related
BorderLayout-Constraints=Constraints BorderLayout-Constraints=Constraints
Write_Preview=Write Preview Write_Preview=Write Preview
PageSetup-Page_Order=Page Order on print PageSetup-Page_Order=Page Order
Verify-Verify_Formula=Verify Formula Verify-Verify_Formula=Verify Formula
State=State State=State
FR-Designer-Widget-Style_Body_Background= FR-Designer-Widget-Style_Body_Background=
@ -2070,7 +2070,7 @@ FR-Designer_StyleAlignment_Single_Line=Single_Line
FR-Designer_StyleAlignment_Single_Line(Adjust_Font)=Single_Line(Adjust_Font) FR-Designer_StyleAlignment_Single_Line(Adjust_Font)=Single_Line(Adjust_Font)
FR-Designer_StyleAlignment_Multi_Line(Adjust_Font)=Multi_Line(Adjust_Font) FR-Designer_StyleAlignment_Multi_Line(Adjust_Font)=Multi_Line(Adjust_Font)
FR-Designer_Auto_Adjust_Height=Auto_Adjust_Height FR-Designer_Auto_Adjust_Height=Auto_Adjust_Height
FR-Designer_Auto_Adjust_Wdith=Auto_Adjust_Wdith FR-Designer_Auto_Adjust_Width=Auto_Adjust_Width
FR-Designer_Type_Set=Type_Set FR-Designer_Type_Set=Type_Set
FR-Designer_Dic_Data_Query=Data_Query FR-Designer_Dic_Data_Query=Data_Query
FR-Designer_Dictionary_Dynamic_SQL=Dictionary_Dynamic_SQL FR-Designer_Dictionary_Dynamic_SQL=Dictionary_Dynamic_SQL
@ -2188,3 +2188,25 @@ FR-Designer_Support_Email=Email:
FR-Designer_Tip_Chart_Adaptivity_Unavailable_In_Absolute_Layout=Under the absolute canvas block, the chart does not support the setting of self-adaptive FR-Designer_Tip_Chart_Adaptivity_Unavailable_In_Absolute_Layout=Under the absolute canvas block, the chart does not support the setting of self-adaptive
FR-Designer_Max_Height_Cannot_Be_Negative=The maximum height cannot be negative FR-Designer_Max_Height_Cannot_Be_Negative=The maximum height cannot be negative
FR-Designer_How_To_Join= FR-Designer_How_To_Join=
FR-Designer_Follow_Paper_Settings=follow paper settings
FR-Designer_No_Auto_Adjust=no automatic adjust
FR-Designer_Print_Setting=Print Setting
FR-Designer_Tip_Use_Default_Print_Margin=Hint: if not check, use the default settings as follows.
FR-Designer_Default_Settings=Default configuration
FR-Designer_Inherit_Page_Margin_Setting=Inherit page margin setting
FR-Designer_Margin=Margin
FR-Designer_Order=Order
FR-Designer_Tip_Native_Print_Need_Client=Hint: native printing requires the terminal to download the client, but it can support more and more powerful functions.
FR-Designer_Tip_Use_Default_Settings=Hint: if you don't check, use the default settings as follows.
FR-Designer_Inherit_Page_Paper_Setting=Inherit page paper setting
FR-Designer_Inherit_Page_Layout_Setting=Inherit page layout setting
FR-Designer_Print_To_Fit_Paper_Size=Print to fit paper size
FR-Designer_Printer=Printer
FR-Designer_Copy_Number=The number of copies
FR-Designer_Paper=Paper
FR-Designer_All_Pages=All pages
FR-Designer_Current_Page=Current page
FR-Designer_Print_Area_Tip=eg(1, 4-9, 6, 8)
FR-Designer_Image_Compress=
FR-Designer_Image_Loading=
FR-Designer_Use_New_Print_Tip=Only display for compatibility, please use the new print

26
designer_base/src/com/fr/design/locale/designer_en_US.properties

@ -1653,7 +1653,7 @@ Parameter_Setting=Parameter Setting
Related=Linkage Related=Linkage
BorderLayout-Constraints=Placement BorderLayout-Constraints=Placement
Write_Preview=Filling Preview Write_Preview=Filling Preview
PageSetup-Page_Order=Print Order PageSetup-Page_Order=Page Order
Verify-Verify_Formula=Validation formula Verify-Verify_Formula=Validation formula
State=State State=State
FR-Designer-Widget-Style_Body_Background=Body Background FR-Designer-Widget-Style_Body_Background=Body Background
@ -2072,7 +2072,7 @@ FR-Designer_StyleAlignment_Single_Line=Single Line
FR-Designer_StyleAlignment_Single_Line(Adjust_Font)=Single Line(Adjust Font) FR-Designer_StyleAlignment_Single_Line(Adjust_Font)=Single Line(Adjust Font)
FR-Designer_StyleAlignment_Multi_Line(Adjust_Font)=Multi Line(Adjust Font) FR-Designer_StyleAlignment_Multi_Line(Adjust_Font)=Multi Line(Adjust Font)
FR-Designer_Auto_Adjust_Height=Auto Adjust Height FR-Designer_Auto_Adjust_Height=Auto Adjust Height
FR-Designer_Auto_Adjust_Wdith=Auto Adjust Wdith FR-Designer_Auto_Adjust_Width=Auto Adjust Wdith
FR-Designer_Type_Set=Type Set FR-Designer_Type_Set=Type Set
FR-Designer_Dic_Data_Query=Data Query FR-Designer_Dic_Data_Query=Data Query
FR-Designer_Dictionary_Dynamic_SQL=Dictionary Dynamic SQL FR-Designer_Dictionary_Dynamic_SQL=Dictionary Dynamic SQL
@ -2187,3 +2187,25 @@ FR-Designer_Support_Email=Email:
FR-Designer_Tip_Chart_Adaptivity_Unavailable_In_Absolute_Layout=Under the absolute canvas block, the chart does not support the setting of self-adaptive FR-Designer_Tip_Chart_Adaptivity_Unavailable_In_Absolute_Layout=Under the absolute canvas block, the chart does not support the setting of self-adaptive
FR-Designer_Max_Height_Cannot_Be_Negative=The maximum height cannot be negative FR-Designer_Max_Height_Cannot_Be_Negative=The maximum height cannot be negative
FR-Designer_How_To_Join=Poke me to learn how to join the thank you list FR-Designer_How_To_Join=Poke me to learn how to join the thank you list
FR-Designer_Follow_Paper_Settings=follow paper settings
FR-Designer_No_Auto_Adjust=no automaticly adjust
FR-Designer_Print_Setting=Print Setting
FR-Designer_Tip_Use_Default_Print_Margin=Hint: if not check, use the default settings as follows.
FR-Designer_Default_Settings=Default configuration
FR-Designer_Inherit_Page_Margin_Setting=Inherit page margin setting
FR-Designer_Margin=Margin
FR-Designer_Order=Order
FR-Designer_Tip_Native_Print_Need_Client=Hint: native printing requires the terminal to download the client, but it can support more and more powerful functions.
FR-Designer_Tip_Use_Default_Settings=Hint: if you don't check, use the default settings as follows.
FR-Designer_Inherit_Page_Paper_Setting=Inherit page paper setting
FR-Designer_Inherit_Page_Layout_Setting=Inherit page layout setting
FR-Designer_Print_To_Fit_Paper_Size=Print to fit paper size
FR-Designer_Printer=Printer
FR-Designer_Copy_Number=The number of copies
FR-Designer_Paper=Paper
FR-Designer_All_Pages=All pages
FR-Designer_Current_Page=Current page
FR-Designer_Print_Area_Tip=eg(1, 4-9, 6, 8)
FR-Designer_Image_Compress=Compress Image
FR-Designer_Image_Loading=Loading Image...
FR-Designer_Use_New_Print_Tip=Only display for compatibility, please use the new print

24
designer_base/src/com/fr/design/locale/designer_ja_JP.properties

@ -2050,7 +2050,7 @@ FR-Designer_StyleAlignment_Single_Line=
FR-Designer_StyleAlignment_Single_Line(Adjust_Font)= FR-Designer_StyleAlignment_Single_Line(Adjust_Font)=
FR-Designer_StyleAlignment_Multi_Line(Adjust_Font)= FR-Designer_StyleAlignment_Multi_Line(Adjust_Font)=
FR-Designer_Auto_Adjust_Height= FR-Designer_Auto_Adjust_Height=
FR-Designer_Auto_Adjust_Wdith= FR-Designer_Auto_Adjust_Width=
FR-Designer_Type_Set= FR-Designer_Type_Set=
FR-Designer_Dic_Data_Query= FR-Designer_Dic_Data_Query=
FR-Designer_Dictionary_Dynamic_SQL= FR-Designer_Dictionary_Dynamic_SQL=
@ -2185,3 +2185,25 @@ FR-Designer_Support_Email=
FR-Designer_Tip_Chart_Adaptivity_Unavailable_In_Absolute_Layout= FR-Designer_Tip_Chart_Adaptivity_Unavailable_In_Absolute_Layout=
FR-Designer_Max_Height_Cannot_Be_Negative= FR-Designer_Max_Height_Cannot_Be_Negative=
FR-Designer_How_To_Join= FR-Designer_How_To_Join=
FR-Designer_Follow_Paper_Settings=
FR-Designer_No_Auto_Adjust=
FR-Designer_Print_Setting=\u5370\u5237\u8A2D\u5B9A
FR-Designer_Tip_Use_Default_Print_Margin=
FR-Designer_Default_Settings=
FR-Designer_Inherit_Page_Margin_Setting=
FR-Designer_Margin=
FR-Designer_Order=
FR-Designer_Tip_Native_Print_Need_Client=
FR-Designer_Tip_Use_Default_Settings=
FR-Designer_Inherit_Page_Paper_Setting=
FR-Designer_Inherit_Page_Layout_Setting=
FR-Designer_Print_To_Fit_Paper_Size=\u7D19\u306E\u30B5\u30A4\u30BA\u306B\u5408\u308F\u305B\u3066\u5370\u5237
FR-Designer_Printer=
FR-Designer_Copy_Number=
FR-Designer_Paper=
FR-Designer_All_Pages=
FR-Designer_Current_Page=
FR-Designer_Print_Area_Tip=
FR-Designer_Image_Compress=
FR-Designer_Image_Loading=
FR-Designer_Use_New_Print_Tip=

24
designer_base/src/com/fr/design/locale/designer_ko_KR.properties

@ -2048,7 +2048,7 @@ FR-Designer_StyleAlignment_Single_Line=
FR-Designer_StyleAlignment_Single_Line(Adjust_Font)= FR-Designer_StyleAlignment_Single_Line(Adjust_Font)=
FR-Designer_StyleAlignment_Multi_Line(Adjust_Font)= FR-Designer_StyleAlignment_Multi_Line(Adjust_Font)=
FR-Designer_Auto_Adjust_Height= FR-Designer_Auto_Adjust_Height=
FR-Designer_Auto_Adjust_Wdith= FR-Designer_Auto_Adjust_Width=
FR-Designer_Type_Set= FR-Designer_Type_Set=
FR-Designer_Dic_Data_Query= FR-Designer_Dic_Data_Query=
FR-Designer_Dictionary_Dynamic_SQL= FR-Designer_Dictionary_Dynamic_SQL=
@ -2186,3 +2186,25 @@ FR-Designer_Support_Email=
FR-Designer_Tip_Chart_Adaptivity_Unavailable_In_Absolute_Layout= FR-Designer_Tip_Chart_Adaptivity_Unavailable_In_Absolute_Layout=
FR-Designer_Max_Height_Cannot_Be_Negative= FR-Designer_Max_Height_Cannot_Be_Negative=
FR-Designer_How_To_Join= FR-Designer_How_To_Join=
FR-Designer_Follow_Paper_Settings=
FR-Designer_No_Auto_Adjust=
FR-Designer_Print_Setting=\uC778\uC1C4\uC124\uC815
FR-Designer_Tip_Use_Default_Print_Margin=
FR-Designer_Default_Settings=
FR-Designer_Inherit_Page_Margin_Setting=
FR-Designer_Margin=
FR-Designer_Order=
FR-Designer_Tip_Native_Print_Need_Client=
FR-Designer_Tip_Use_Default_Settings=
FR-Designer_Inherit_Page_Paper_Setting=
FR-Designer_Inherit_Page_Layout_Setting=
FR-Designer_Print_To_Fit_Paper_Size=\uC885\uC774\uD06C\uAE30\uC5D0\uB530\uB978\uC778\uC1C4\uCD95\uC18C
FR-Designer_Printer=
FR-Designer_Copy_Number=
FR-Designer_Paper=
FR-Designer_All_Pages=
FR-Designer_Current_Page=
FR-Designer_Print_Area_Tip=
FR-Designer_Image_Compress=
FR-Designer_Image_Loading=
FR-Designer_Use_New_Print_Tip=

26
designer_base/src/com/fr/design/locale/designer_zh_CN.properties

@ -1654,7 +1654,7 @@ Parameter_Setting=\u53C2\u6570\u8BBE\u7F6E
Related=\u8054\u52A8 Related=\u8054\u52A8
BorderLayout-Constraints=\u4F4D\u7F6E BorderLayout-Constraints=\u4F4D\u7F6E
Write_Preview=\u586B\u62A5\u9884\u89C8 Write_Preview=\u586B\u62A5\u9884\u89C8
PageSetup-Page_Order=\u6253\u5370\u987A\u5E8F PageSetup-Page_Order=\u5206\u9875\u987A\u5E8F
Verify-Verify_Formula=\u6821\u9A8C\u516C\u5F0F Verify-Verify_Formula=\u6821\u9A8C\u516C\u5F0F
State=\u7701\u5E02 State=\u7701\u5E02
FR-Designer-Widget-Style_Body_Background=\u4E3B\u4F53\u80CC\u666F FR-Designer-Widget-Style_Body_Background=\u4E3B\u4F53\u80CC\u666F
@ -2072,7 +2072,7 @@ FR-Designer_StyleAlignment_Single_Line=\u5355\u884C\u663E\u793A
FR-Designer_StyleAlignment_Single_Line(Adjust_Font)=\u5355\u884C\u663E\u793A(\u8C03\u6574\u5B57\u4F53) FR-Designer_StyleAlignment_Single_Line(Adjust_Font)=\u5355\u884C\u663E\u793A(\u8C03\u6574\u5B57\u4F53)
FR-Designer_StyleAlignment_Multi_Line(Adjust_Font)=\u591A\u884C\u663E\u793A(\u8C03\u6574\u5B57\u4F53) FR-Designer_StyleAlignment_Multi_Line(Adjust_Font)=\u591A\u884C\u663E\u793A(\u8C03\u6574\u5B57\u4F53)
FR-Designer_Auto_Adjust_Height=\u81EA\u52A8\u8C03\u6574\u884C\u9AD8 FR-Designer_Auto_Adjust_Height=\u81EA\u52A8\u8C03\u6574\u884C\u9AD8
FR-Designer_Auto_Adjust_Wdith=\u81EA\u52A8\u8C03\u6574\u5217\u5BBD FR-Designer_Auto_Adjust_Width=\u81EA\u52A8\u8C03\u6574\u5217\u5BBD
FR-Designer_Type_Set=\u7C7B\u578B\u8BBE\u7F6E FR-Designer_Type_Set=\u7C7B\u578B\u8BBE\u7F6E
FR-Designer_Dic_Data_Query=\u6570\u636E\u67E5\u8BE2 FR-Designer_Dic_Data_Query=\u6570\u636E\u67E5\u8BE2
FR-Designer_Dictionary_Dynamic_SQL=\u52A8\u6001SQL FR-Designer_Dictionary_Dynamic_SQL=\u52A8\u6001SQL
@ -2188,3 +2188,25 @@ FR-Designer_Support_Email=\u652F\u6301\u90AE\u7BB1\uFF1A
FR-Designer_Tip_Chart_Adaptivity_Unavailable_In_Absolute_Layout=\u7EDD\u5BF9\u753B\u5E03\u5757\u72B6\u6001\u4E0B\uFF0C\u56FE\u8868\u4E0D\u652F\u6301\u8BBE\u7F6E\u81EA\u9002\u5E94 FR-Designer_Tip_Chart_Adaptivity_Unavailable_In_Absolute_Layout=\u7EDD\u5BF9\u753B\u5E03\u5757\u72B6\u6001\u4E0B\uFF0C\u56FE\u8868\u4E0D\u652F\u6301\u8BBE\u7F6E\u81EA\u9002\u5E94
FR-Designer_Max_Height_Cannot_Be_Negative=\u6700\u5927\u9AD8\u5EA6\u4E0D\u53EF\u4E3A\u8D1F\u503C FR-Designer_Max_Height_Cannot_Be_Negative=\u6700\u5927\u9AD8\u5EA6\u4E0D\u53EF\u4E3A\u8D1F\u503C
FR-Designer_How_To_Join=\u6233\u6211\u4E86\u89E3\u5982\u4F55\u52A0\u5165\u81F4\u8C22\u540D\u5355 FR-Designer_How_To_Join=\u6233\u6211\u4E86\u89E3\u5982\u4F55\u52A0\u5165\u81F4\u8C22\u540D\u5355
FR-Designer_Follow_Paper_Settings=\u8DDF\u968F\u9875\u9762\u8BBE\u7F6E
FR-Designer_No_Auto_Adjust=\u4E0D\u81EA\u52A8\u8C03\u6574
FR-Designer_Print_Setting=\u6253\u5370\u8BBE\u7F6E
FR-Designer_Tip_Use_Default_Print_Margin=\u63D0\u793A\uFF1A\u82E5\u4E0D\u52FE\u9009\uFF0C\u5219\u4F7F\u7528\u5982\u4E0B\u9ED8\u8BA4\u8BBE\u7F6E\u4E2D\u7684\u6253\u5370\u8FB9\u8DDD\u3002
FR-Designer_Default_Settings=\u9ED8\u8BA4\u914D\u7F6E
FR-Designer_Inherit_Page_Margin_Setting=\u7EE7\u627F\u9875\u9762\u8FB9\u8DDD\u8BBE\u7F6E
FR-Designer_Margin=\u8FB9\u8DDD
FR-Designer_Order=\u987A\u5E8F
FR-Designer_Tip_Native_Print_Need_Client=\u63D0\u793A\uFF1A\u672C\u5730\u8F6F\u4EF6\u6253\u5370\u9700\u8981\u7EC8\u7AEF\u4E0B\u8F7D\u5BA2\u6237\u7AEF\uFF0C\u4F46\u80FD\u652F\u6301\u66F4\u591A\u3001\u66F4\u5F3A\u5927\u7684\u529F\u80FD\u3002
FR-Designer_Tip_Use_Default_Settings=\u63D0\u793A\uFF1A\u82E5\u4E0D\u52FE\u9009\uFF0C\u5219\u4F7F\u7528\u5982\u4E0B\u9ED8\u8BA4\u8BBE\u7F6E\u3002
FR-Designer_Inherit_Page_Paper_Setting=\u7EE7\u627F\u9875\u9762\u7EB8\u5F20\u8BBE\u7F6E
FR-Designer_Inherit_Page_Layout_Setting=\u7EE7\u627F\u9875\u9762\u5E03\u5C40\u8BBE\u7F6E
FR-Designer_Print_To_Fit_Paper_Size=\u6839\u636E\u7EB8\u5F20\u5927\u5C0F\u7F29\u653E\u6253\u5370
FR-Designer_Printer=\u6253\u5370\u673A
FR-Designer_Copy_Number=\u4EFD\u6570
FR-Designer_Paper=\u7EB8\u5F20
FR-Designer_All_Pages=\u6240\u6709\u9875
FR-Designer_Current_Page=\u5F53\u524D\u9875
FR-Designer_Print_Area_Tip=\u683C\u5F0F(1, 4-9, 6, 8)
FR-Designer_Image_Compress=\u56FE\u7247\u538B\u7F29
FR-Designer_Image_Loading=\u6B63\u5728\u6253\u5F00\u56FE\u7247...
FR-Designer_Use_New_Print_Tip=\u8BE5\u529F\u80FD\u53EA\u505A\u517C\u5BB9\u663E\u793A\uFF0C\u8BF7\u4F7F\u7528\u65B0\u7248\u6253\u5370

26
designer_base/src/com/fr/design/locale/designer_zh_TW.properties

@ -1652,7 +1652,7 @@ Parameter_Setting=\u53C3\u6578\u8A2D\u5B9A
Related=\u806F\u52D5 Related=\u806F\u52D5
BorderLayout-Constraints=\u4F4D\u7F6E BorderLayout-Constraints=\u4F4D\u7F6E
Write_Preview=\u586B\u5831\u9810\u89BD Write_Preview=\u586B\u5831\u9810\u89BD
PageSetup-Page_Order=\u5217\u5370\u9806\u5E8F PageSetup-Page_Order=\u5206\u9801\u9806\u5E8F
Verify-Verify_Formula=\u6821\u9A57\u516C\u5F0F Verify-Verify_Formula=\u6821\u9A57\u516C\u5F0F
State=\u7701\u5E02 State=\u7701\u5E02
FR-Designer-Widget-Style_Body_Background=\u4E3B\u9AD4\u80CC\u666F FR-Designer-Widget-Style_Body_Background=\u4E3B\u9AD4\u80CC\u666F
@ -2068,7 +2068,7 @@ FR-Designer_StyleAlignment_Single_Line=\u55AE\u884C\u986F\u793A
FR-Designer_StyleAlignment_Single_Line(Adjust_Font)=\u55AE\u884C\u986F\u793A(\u8ABF\u6574\u5B57\u578B) FR-Designer_StyleAlignment_Single_Line(Adjust_Font)=\u55AE\u884C\u986F\u793A(\u8ABF\u6574\u5B57\u578B)
FR-Designer_StyleAlignment_Multi_Line(Adjust_Font)=\u591A\u884C\u986F\u793A(\u8ABF\u6574\u5B57\u578B) FR-Designer_StyleAlignment_Multi_Line(Adjust_Font)=\u591A\u884C\u986F\u793A(\u8ABF\u6574\u5B57\u578B)
FR-Designer_Auto_Adjust_Height=\u81EA\u52D5\u8ABF\u6574\u884C\u9AD8 FR-Designer_Auto_Adjust_Height=\u81EA\u52D5\u8ABF\u6574\u884C\u9AD8
FR-Designer_Auto_Adjust_Wdith=\u81EA\u52D5\u8ABF\u6574\u5217\u5BEC FR-Designer_Auto_Adjust_Width=\u81EA\u52D5\u8ABF\u6574\u5217\u5BEC
FR-Designer_Type_Set=\u578B\u5225\u8A2D\u5B9A FR-Designer_Type_Set=\u578B\u5225\u8A2D\u5B9A
FR-Designer_Dic_Data_Query=\u8CC7\u6599\u67E5\u8A62 FR-Designer_Dic_Data_Query=\u8CC7\u6599\u67E5\u8A62
FR-Designer_Dictionary_Dynamic_SQL=\u52D5\u614BSQL FR-Designer_Dictionary_Dynamic_SQL=\u52D5\u614BSQL
@ -2187,3 +2187,25 @@ FR-Designer_Support_Email=\u652F\u6301\u90F5\u7BB1\uFF1A
FR-Designer_Tip_Chart_Adaptivity_Unavailable_In_Absolute_Layout=\u7D55\u5C0D\u756B\u5E03\u584A\u72C0\u614B\u4E0B\uFF0C\u5716\u8868\u4E0D\u652F\u6301\u8A2D\u5B9A\u81EA\u6211\u8ABF\u6574 FR-Designer_Tip_Chart_Adaptivity_Unavailable_In_Absolute_Layout=\u7D55\u5C0D\u756B\u5E03\u584A\u72C0\u614B\u4E0B\uFF0C\u5716\u8868\u4E0D\u652F\u6301\u8A2D\u5B9A\u81EA\u6211\u8ABF\u6574
FR-Designer_Max_Height_Cannot_Be_Negative=\u6700\u5927\u9AD8\u5EA6\u4E0D\u53EF\u70BA\u8CA0\u503C FR-Designer_Max_Height_Cannot_Be_Negative=\u6700\u5927\u9AD8\u5EA6\u4E0D\u53EF\u70BA\u8CA0\u503C
FR-Designer_How_To_Join=\u6233\u6211\u4E86\u89E3\u5982\u4F55\u52A0\u5165\u81F4\u8B1D\u540D\u55AE FR-Designer_How_To_Join=\u6233\u6211\u4E86\u89E3\u5982\u4F55\u52A0\u5165\u81F4\u8B1D\u540D\u55AE
FR-Designer_Follow_Paper_Settings=\u8DDF\u96A8\u9801\u9762\u8A2D\u5B9A
FR-Designer_No_Auto_Adjust=\u4E0D\u81EA\u52D5\u8ABF\u6574
FR-Designer_Print_Setting=\u5217\u5370\u8A2D\u5B9A
FR-Designer_Tip_Use_Default_Print_Margin=\u63D0\u793A\uFF1A\u82E5\u4E0D\u52FE\u9078\uFF0C\u5247\u4F7F\u7528\u5982\u4E0B\u9ED8\u8A8D\u8A2D\u7F6E\u4E2D\u7684\u5217\u5370\u908A\u8DDD\u3002
FR-Designer_Default_Settings=\u9ED8\u8A8D\u914D\u5BD8
FR-Designer_Inherit_Page_Margin_Setting=\u7E7C\u627F\u9801\u9762\u908A\u8DDD\u8A2D\u5B9A
FR-Designer_Margin=\u908A\u8DDD
FR-Designer_Order=\u9806\u5E8F
FR-Designer_Tip_Native_Print_Need_Client=\u63D0\u793A\uFF1A\u672C\u5730\u8EDF\u4EF6\u5217\u5370\u9700\u8981\u7D42\u7AEF\u4E0B\u8F09\u7528\u6236\u7AEF\uFF0C\u4F46\u80FD\u652F\u6301\u66F4\u591A\u3001\u66F4\u5F3A\u5927\u7684\u529F\u80FD\u3002
FR-Designer_Tip_Use_Default_Settings=\u63D0\u793A\uFF1A\u82E5\u4E0D\u52FE\u9078\uFF0C\u5247\u4F7F\u7528\u5982\u4E0B\u9ED8\u8A8D\u8A2D\u7F6E\u3002
FR-Designer_Inherit_Page_Paper_Setting=\u7E7C\u627F\u9801\u9762\u7D19\u5F35\u8A2D\u5B9A
FR-Designer_Inherit_Page_Layout_Setting=\u7E7C\u627F\u9801\u9762\u4F48\u5C40\u8A2D\u5B9A
FR-Designer_Print_To_Fit_Paper_Size=\u6839\u64DA\u7D19\u5F35\u5927\u5C0F\u7E2E\u653E\u5217\u5370
FR-Designer_Printer=\u6253\u5370\u6A5F
FR-Designer_Copy_Number=\u4EFD\u6578
FR-Designer_Paper=\u7D19\u5F35
FR-Designer_All_Pages=\u6240\u6709\u9801
FR-Designer_Current_Page=\u7576\u524D\u9801
FR-Designer_Print_Area_Tip=\u683C\u5F0F(1, 4-9, 6, 8)
FR-Designer_Image_Compress=\u5716\u7247\u58D3\u7E2E
FR-Designer_Image_Loading=\u6B63\u5728\u6253\u958B\u5716\u7247\u2026
FR-Designer_Use_New_Print_Tip=\u8A72\u529F\u80FD\u53EA\u505A\u76F8\u5BB9\u986F\u793A\uFF0C\u8ACB\u4F7F\u7528\u65B0\u7248\u5217\u5370

7
designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java

@ -231,6 +231,13 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
updateAllPropertyPane(); updateAllPropertyPane();
} }
/**
* 可通过此方法判断当前的编辑模式
* */
public PropertyMode getCurrentMode() {
return currentMode;
}
public void updateAllPropertyPane() { public void updateAllPropertyPane() {
updatePropertyItemMap(); updatePropertyItemMap();
initContentPane(); initContentPane();

4
designer_base/src/com/fr/design/mainframe/JTemplate.java

@ -80,7 +80,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
protected U undoState; protected U undoState;
protected U authorityUndoState = null; protected U authorityUndoState = null;
protected T template; // 当前模板 protected T template; // 当前模板
protected TemplateProcessInfo processInfo; // 模板过程的相关信息 protected TemplateProcessInfo<T> processInfo; // 模板过程的相关信息
private static short currentIndex = 0;// 此变量用于多次新建模板时,让名字不重复 private static short currentIndex = 0;// 此变量用于多次新建模板时,让名字不重复
private DesignModelAdapter<T, ?> designModel; private DesignModelAdapter<T, ?> designModel;
private PreviewProvider previewType; private PreviewProvider previewType;
@ -143,7 +143,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
openTime = saveTime; // 更新 openTime,准备下一次计算 openTime = saveTime; // 更新 openTime,准备下一次计算
} }
public abstract TemplateProcessInfo getProcessInfo(); public abstract TemplateProcessInfo<T> getProcessInfo();
// 追加过程记录 // 追加过程记录
public void appendProcess(String s) { public void appendProcess(String s) {

35
designer_base/src/com/fr/design/mainframe/backgroundpane/ImageBackgroundQuickPane.java

@ -1,28 +1,27 @@
package com.fr.design.mainframe.backgroundpane; package com.fr.design.mainframe.backgroundpane;
import com.fr.base.BaseUtils;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.background.ImageBackground; import com.fr.base.background.ImageBackground;
import com.fr.design.constants.UIConstants;
import com.fr.design.border.UIRoundedBorder; import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.frpane.ImgChooseWrapper;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.style.background.image.ImageFileChooser;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.CoreGraphHelper;
import com.fr.design.style.background.image.ImageFileChooser;
import javax.swing.*; import javax.swing.JPanel;
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.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.io.File;
/** /**
* @author zhou * @author zhou
@ -65,7 +64,7 @@ public class ImageBackgroundQuickPane extends BackgroundQuickPane {
UIButton selectPictureButton = new UIButton(Inter.getLocText("Image-Select_Picture")); UIButton selectPictureButton = new UIButton(Inter.getLocText("Image-Select_Picture"));
selectPictureButton.addActionListener(selectPictureActionListener); selectPictureButton.addActionListener(selectPictureActionListener);
if(hasImageLayout){ if (hasImageLayout) {
southPane.add(imageLayoutPane, BorderLayout.SOUTH); southPane.add(imageLayoutPane, BorderLayout.SOUTH);
} }
southPane.add(selectPictureButton, BorderLayout.CENTER); southPane.add(selectPictureButton, BorderLayout.CENTER);
@ -92,26 +91,12 @@ public class ImageBackgroundQuickPane extends BackgroundQuickPane {
imageFileChooser.setMultiSelectionEnabled(false); imageFileChooser.setMultiSelectionEnabled(false);
} }
int returnVal = imageFileChooser.showOpenDialog(DesignerContext.getDesignerFrame()); int returnVal = imageFileChooser.showOpenDialog(DesignerContext.getDesignerFrame());
if (returnVal != JFileChooser.CANCEL_OPTION) {
File selectedFile = imageFileChooser.getSelectedFile();
if (selectedFile != null && selectedFile.isFile()) {
Image image = BaseUtils.readImage(selectedFile.getPath());
CoreGraphHelper.waitForImage(image);
previewPane.setImage(image);
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(imageLayoutPane.getSelectedItem()); imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(imageLayoutPane.getSelectedItem());
previewPane.setImageStyle(imageStyle); ImgChooseWrapper.getInstance(previewPane, imageFileChooser, imageStyle, changeListener).dealWithImageFile(returnVal);
previewPane.repaint();
} else {
previewPane.setImage(null);
}
fireChagneListener();
}
} }
}; };
public void populateBean(Background background) { public void populateBean(Background background) {
ImageBackground imageBackground = (ImageBackground) background; ImageBackground imageBackground = (ImageBackground) background;
@ -165,6 +150,7 @@ public class ImageBackgroundQuickPane extends BackgroundQuickPane {
/** /**
* 判断是否是图片背景 * 判断是否是图片背景
*
* @param background 背景 * @param background 背景
* @return 判断是否是图片背景 * @return 判断是否是图片背景
*/ */
@ -174,6 +160,7 @@ public class ImageBackgroundQuickPane extends BackgroundQuickPane {
/** /**
* 标题 * 标题
*
* @return 标题 * @return 标题
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {

86
designer_base/src/com/fr/design/mainframe/backgroundpane/ImagePreviewPane.java

@ -4,38 +4,38 @@ package com.fr.design.mainframe.backgroundpane;
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. * Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved.
*/ */
import java.awt.BorderLayout; import com.fr.base.BaseUtils;
import java.awt.Dimension; import com.fr.base.GraphHelper;
import java.awt.FontMetrics; import com.fr.base.Style;
import java.awt.Graphics; import com.fr.design.constants.UIConstants;
import java.awt.Image; import com.fr.design.gui.ilable.UILabel;
import java.awt.Rectangle; import com.fr.design.gui.iscrollbar.UIScrollBar;
import java.util.ArrayList; import com.fr.design.style.background.image.ImagePreviewer;
import java.util.List; import com.fr.general.Inter;
import com.fr.stable.Constants;
import com.fr.stable.CoreGraphHelper;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JComponent; import javax.swing.JComponent;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JViewport; import javax.swing.JViewport;
import javax.swing.Scrollable; import javax.swing.Scrollable;
import javax.swing.SwingConstants; 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.BorderLayout;
import com.fr.base.BaseUtils; import java.awt.Dimension;
import com.fr.base.GraphHelper; import java.awt.FontMetrics;
import com.fr.base.Style; import java.awt.Graphics;
import com.fr.design.gui.iscrollbar.UIScrollBar; import java.awt.Image;
import com.fr.stable.Constants; import java.awt.Rectangle;
import com.fr.stable.CoreGraphHelper; import java.util.ArrayList;
import java.util.List;
/** /**
* The pane use to preview image * The pane use to preview image
*/ */
public class ImagePreviewPane extends JComponent implements Scrollable { public class ImagePreviewPane extends JComponent implements Scrollable, ImagePreviewer {
private static final int LABEL_DELTA_X = 10; private static final int LABEL_DELTA_X = 10;
private static final int LABEL_DELTA_Y = 20; private static final int LABEL_DELTA_Y = 20;
private static final int LABEL_HEIGHT = 20; private static final int LABEL_HEIGHT = 20;
@ -48,6 +48,7 @@ public class ImagePreviewPane extends JComponent implements Scrollable {
private List<ChangeListener> changeListenerList = new ArrayList<ChangeListener>(); private List<ChangeListener> changeListenerList = new ArrayList<ChangeListener>();
private UILabel sizeLabel; private UILabel sizeLabel;
private boolean isLoading = false;
public ImagePreviewPane() { public ImagePreviewPane() {
sizeLabel = new UILabel(); sizeLabel = new UILabel();
@ -57,7 +58,10 @@ public class ImagePreviewPane extends JComponent implements Scrollable {
this.add(new JPanel() { this.add(new JPanel() {
public void paintComponent(Graphics g) { public void paintComponent(Graphics g) {
super.paintComponent(g); super.paintComponent(g);
if (isLoading) {
g.drawString(Inter.getLocText("FR-Designer_Image_Loading"), getWidth() / 2 - 25, getHeight() / 2);
return;
}
// draw image. // draw image.
if (getImage() != null) { if (getImage() != null) {
// carl:让imagePreviewPane能预览样式 // carl:让imagePreviewPane能预览样式
@ -66,7 +70,7 @@ public class ImagePreviewPane extends JComponent implements Scrollable {
} else { } else {
if (getImage().getWidth(this) > getWidth() || getImage().getHeight(this) > getHeight()) { if (getImage().getWidth(this) > getWidth() || getImage().getHeight(this) > getHeight()) {
GraphHelper.paintImageMoved(g, this.getWidth(), this.getHeight(), getImage(), Constants.IMAGE_ADJUST, BaseUtils.getAlignment4Horizontal(getImageStyle()), GraphHelper.paintImageMoved(g, this.getWidth(), this.getHeight(), getImage(), Constants.IMAGE_ADJUST, BaseUtils.getAlignment4Horizontal(getImageStyle()),
getImageStyle().getVerticalAlignment(), -1, -1,0, 0, false, UIConstants.NORMAL_BACKGROUND); getImageStyle().getVerticalAlignment(), -1, -1, 0, 0, false, UIConstants.NORMAL_BACKGROUND);
} else { } else {
int totalwidth = this.getWidth(); int totalwidth = this.getWidth();
int totalheight = this.getHeight(); int totalheight = this.getHeight();
@ -89,8 +93,7 @@ public class ImagePreviewPane extends JComponent implements Scrollable {
/** /**
* Set image. * Set image.
* *
* @param image * @param image the new image.
* the new image.
*/ */
public void setImage(Image image) { public void setImage(Image image) {
this.image = image; this.image = image;
@ -100,13 +103,14 @@ public class ImagePreviewPane extends JComponent implements Scrollable {
UIScrollBar tmpJScrollBar = new UIScrollBar(UIScrollBar.HORIZONTAL); UIScrollBar tmpJScrollBar = new UIScrollBar(UIScrollBar.HORIZONTAL);
Dimension newDimension = new Dimension(this.getSize().width - tmpJScrollBar.getPreferredSize().height, this.getSize().height Dimension newDimension = new Dimension(this.getSize().width - tmpJScrollBar.getPreferredSize().height, this.getSize().height
- tmpJScrollBar.getPreferredSize().height); - tmpJScrollBar.getPreferredSize().height);
((JViewport)this.getParent()).setPreferredSize(newDimension); ((JViewport) this.getParent()).setPreferredSize(newDimension);
(this.getParent()).setSize(newDimension); (this.getParent()).setSize(newDimension);
((JViewport)this.getParent()).setMinimumSize(newDimension); ((JViewport) this.getParent()).setMinimumSize(newDimension);
((JViewport)this.getParent()).setMaximumSize(newDimension); ((JViewport) this.getParent()).setMaximumSize(newDimension);
} }
sizeLabel.setText(null); sizeLabel.setText(null);
} else { } else {
isLoading = false;
// wait for the size of image. // wait for the size of image.
CoreGraphHelper.waitForImage(image); CoreGraphHelper.waitForImage(image);
@ -124,6 +128,12 @@ public class ImagePreviewPane extends JComponent implements Scrollable {
this.revalidate(); this.revalidate();
} }
public void showLoading() {
isLoading = true;
setImage(null);
repaint();
}
/** /**
* Paint component. * Paint component.
*/ */
@ -181,17 +191,13 @@ public class ImagePreviewPane extends JComponent implements Scrollable {
* area. Subclasses are likely to be able to provide a much more reasonable * area. Subclasses are likely to be able to provide a much more reasonable
* value. * value.
* *
* @param visibleRect * @param visibleRect the view area visible within the viewport
* the view area visible within the viewport * @param orientation either <code>SwingConstants.VERTICAL</code> or
* @param orientation
* either <code>SwingConstants.VERTICAL</code> or
* <code>SwingConstants.HORIZONTAL</code> * <code>SwingConstants.HORIZONTAL</code>
* @param direction * @param direction less than zero to scroll up/left, greater than zero for
* less than zero to scroll up/left, greater than zero for
* down/right * down/right
* @return the "unit" increment for scrolling in the specified direction * @return the "unit" increment for scrolling in the specified direction
* @throws IllegalArgumentException * @throws IllegalArgumentException for an invalid orientation
* for an invalid orientation
* @see javax.swing.JScrollBar#setUnitIncrement * @see javax.swing.JScrollBar#setUnitIncrement
*/ */
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) {
@ -213,17 +219,13 @@ public class ImagePreviewPane extends JComponent implements Scrollable {
* The default implementation of this is to simply return the visible area. * The default implementation of this is to simply return the visible area.
* Subclasses will likely be able to provide a much more reasonable value. * Subclasses will likely be able to provide a much more reasonable value.
* *
* @param visibleRect * @param visibleRect the view area visible within the viewport
* the view area visible within the viewport * @param orientation either <code>SwingConstants.VERTICAL</code> or
* @param orientation
* either <code>SwingConstants.VERTICAL</code> or
* <code>SwingConstants.HORIZONTAL</code> * <code>SwingConstants.HORIZONTAL</code>
* @param direction * @param direction less than zero to scroll up/left, greater than zero for
* less than zero to scroll up/left, greater than zero for
* down/right * down/right
* @return the "block" increment for scrolling in the specified direction * @return the "block" increment for scrolling in the specified direction
* @throws IllegalArgumentException * @throws IllegalArgumentException for an invalid orientation
* for an invalid orientation
* @see javax.swing.JScrollBar#setBlockIncrement * @see javax.swing.JScrollBar#setBlockIncrement
*/ */
public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) { public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) {

1
designer_base/src/com/fr/design/mainframe/form/FormECDesignerProvider.java

@ -89,4 +89,5 @@ public interface FormECDesignerProvider {
*/ */
BufferedImage getElementCaseImage(Dimension elementCaseContainerSize); BufferedImage getElementCaseImage(Dimension elementCaseContainerSize);
void refreshPropertyPane();
} }

196
designer_base/src/com/fr/design/style/background/image/ExpandFileChooser.java

@ -0,0 +1,196 @@
package com.fr.design.style.background.image;
import com.fr.base.BaseUtils;
import com.fr.design.DesignerEnvManager;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import com.fr.stable.StringUtils;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JPanel;
import javax.swing.plaf.metal.MetalFileChooserUI;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.LayoutManager;
import java.awt.event.ActionListener;
/**
* 扩展的文件选择框(底部控制区域扩展一个复选框)
* Created by zack on 2018/3/8.
*/
public class ExpandFileChooser extends JFileChooser {
private JDialog dialog;
private UICheckBox checkBox;//选择框底部的复选按钮
private int retVal = ERROR_OPTION;
private UIButton approve;
private UIButton cancel;
private static final int DEFAULT_WIDTH = 520;
public ExpandFileChooser() {
this(StringUtils.EMPTY, StringUtils.EMPTY);
}
public ExpandFileChooser(String checkBoxText, String approveButtonText) {
JPanel previewContainerPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
MetalFileChooserUI chooserUI = (MetalFileChooserUI) getUI();
String approveText = StringUtils.isEmpty(approveButtonText) ? chooserUI.getApproveButtonText(this) : approveButtonText;
dialog = new JDialog();
dialog.setSize(new Dimension(DEFAULT_WIDTH, 362));
dialog.add(previewContainerPane);
dialog.setIconImage(BaseUtils.readImage("/com/fr/base/images/oem/logo.png"));
dialog.setTitle(approveText);
previewContainerPane.add(this, BorderLayout.CENTER);
JPanel bottomControlPanel = new JPanel();
bottomControlPanel.setLayout(new ImageAreaLayout());
bottomControlPanel.setPreferredSize(new Dimension(DEFAULT_WIDTH, 40));
approve = new UIButton(approveText);
cancel = new UIButton(Inter.getLocText("FR-Designer_Button-Cancel"));
if (StringUtils.isNotEmpty(checkBoxText)) {
checkBox = new UICheckBox(checkBoxText);
checkBox.setSelected(DesignerEnvManager.getEnvManager().isImageCompress());
bottomControlPanel.add(checkBox);
checkBox.addActionListener(checkAction());
}
bottomControlPanel.add(approve);
approve.addActionListener(chooserUI.getApproveSelectionAction());
cancel.addActionListener(chooserUI.getCancelSelectionAction());
bottomControlPanel.add(cancel);
previewContainerPane.add(bottomControlPanel, BorderLayout.SOUTH);
GUICoreUtils.centerWindow(dialog);
}
public ActionListener checkAction() {
return null;
}
public boolean isCheckSelected() {
if (checkBox != null) {
return checkBox.isSelected();
}
return false;
}
@Override
public int showDialog(Component parent, String approveButtonText) {
dialog.setModal(true);
dialog.setVisible(true);
return retVal;
}
@Override
public void approveSelection() {
retVal = APPROVE_OPTION;
if (dialog != null) {
dialog.setVisible(false);
}
fireActionPerformed(APPROVE_SELECTION);
}
@Override
public void cancelSelection() {
retVal = CANCEL_OPTION;
if (dialog != null) {
dialog.setVisible(false);
}
fireActionPerformed(CANCEL_SELECTION);
}
@Override
public boolean getControlButtonsAreShown() {
return false;//隐藏默认的控制按钮(打开/取消)
}
private class ImageAreaLayout implements LayoutManager {
private static final int TEN = 10;
private int hGap = 5;
private int topMargin = TEN;
private int leftMargin = TEN;
private int leftStart = 8;
@Override
public void addLayoutComponent(String string, Component comp) {
}
@Override
public void layoutContainer(Container container) {
Component[] children = container.getComponents();
if (children != null && children.length > 0) {
int numChildren = children.length;
Dimension[] sizes = new Dimension[numChildren];
Insets insets = container.getInsets();
int yLocation = insets.top + topMargin;
int maxWidth = 0;
for (int counter = 0; counter < numChildren; counter++) {
sizes[counter] = children[counter].getPreferredSize();
maxWidth = Math.max(maxWidth, sizes[counter].width);
}
int xLocation, xOffset;
if (container.getComponentOrientation().isLeftToRight()) {
xLocation = container.getSize().width - insets.left - maxWidth - leftMargin;
xOffset = hGap + maxWidth;
} else {
xLocation = insets.left;
xOffset = -(hGap + maxWidth);
}
//单独设置图片压缩按钮的位置
children[0].setBounds(leftStart, yLocation,
maxWidth, sizes[0].height);
for (int counter = numChildren - 1; counter >= 1; counter--) {
children[counter].setBounds(xLocation, yLocation,
maxWidth, sizes[counter].height);
xLocation -= xOffset;
}
}
}
@Override
public Dimension minimumLayoutSize(Container c) {
if (c != null) {
Component[] children = c.getComponents();
if (children != null && children.length > 0) {
int numChildren = children.length;
int height = 0;
Insets cInsets = c.getInsets();
int extraHeight = topMargin + cInsets.top + cInsets.bottom;
int extraWidth = cInsets.left + cInsets.right;
int maxWidth = 0;
for (int counter = 0; counter < numChildren; counter++) {
Dimension aSize = children[counter].getPreferredSize();
height = Math.max(height, aSize.height);
maxWidth = Math.max(maxWidth, aSize.width);
}
return new Dimension(extraWidth + numChildren * maxWidth +
(numChildren - 1) * hGap,
extraHeight + height);
}
}
return new Dimension(0, 0);
}
@Override
public Dimension preferredLayoutSize(Container c) {
return minimumLayoutSize(c);
}
@Override
public void removeLayoutComponent(Component c) {
}
}
}

31
designer_base/src/com/fr/design/style/background/image/ImageFileChooser.java

@ -3,25 +3,27 @@
*/ */
package com.fr.design.style.background.image; package com.fr.design.style.background.image;
import com.fr.base.BaseUtils;
import com.fr.design.DesignerEnvManager;
import com.fr.design.style.ChooseFileView;
import com.fr.general.Inter;
import javax.swing.filechooser.FileFilter;
import java.awt.Component; import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File; import java.io.File;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Hashtable; import java.util.Hashtable;
import javax.swing.JFileChooser;
import javax.swing.filechooser.FileFilter;
import com.fr.base.BaseUtils;
import com.fr.general.Inter;
import com.fr.design.style.ChooseFileView;
/** /**
* This class used to choose image files. * This class used to choose image files.
*/ */
public class ImageFileChooser extends JFileChooser { public class ImageFileChooser extends ExpandFileChooser {
public ImageFileChooser() { public ImageFileChooser() {
super(Inter.getLocText("FR-Designer_Image_Compress"),Inter.getLocText("FR-Designer_Open"));
ExampleFileFilter bothFilter = new ExampleFileFilter( ExampleFileFilter bothFilter = new ExampleFileFilter(
new String[]{"jpg", "gif", "png", "bmp"}, new String[]{"jpg", "gif", "png", "bmp"},
Inter.getLocText("Image-Image_Files")); Inter.getLocText("Image-Image_Files"));
@ -43,12 +45,23 @@ public class ImageFileChooser extends JFileChooser {
return super.showDialog(parent, approveButtonText); return super.showDialog(parent, approveButtonText);
} }
@Override
public ActionListener checkAction() {
return new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
DesignerEnvManager.getEnvManager().setImageCompress(isCheckSelected());
DesignerEnvManager.getEnvManager().saveXMLFile();
}
};
}
/** /**
* A convenience implementation of FileFilter that filters out * A convenience implementation of FileFilter that filters out
* all files except for those type extensions that it knows about. * all files except for those type extensions that it knows about.
* <p/>D:\finereport\develop\code\test\TestCase\WEB-INF\reportlets\TestCase\01903.cpt * <p/>D:\finereport\develop\code\test\TestCase\WEB-INF\reportlets\TestCase\01903.cpt
* <p>
* Extensions are of the type ".foo", which is typically found on * Extensions are of the type ".foo", which is typically found on
* Windows and Unix boxes, but not on Macinthosh. Case is ignored. * Windows and Unix boxes, but not on Macinthosh. Case is ignored.
* <p/> * <p/>

48
designer_base/src/com/fr/design/style/background/image/ImagePreviewPane.java

@ -3,12 +3,12 @@
*/ */
package com.fr.design.style.background.image; package com.fr.design.style.background.image;
import java.awt.Dimension; import com.fr.base.BaseUtils;
import java.awt.Graphics; import com.fr.base.GraphHelper;
import java.awt.Image; import com.fr.base.Style;
import java.awt.Rectangle; import com.fr.design.gui.iscrollbar.UIScrollBar;
import java.util.ArrayList; import com.fr.general.Inter;
import java.util.List; import com.fr.stable.CoreGraphHelper;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JViewport; import javax.swing.JViewport;
@ -16,22 +16,23 @@ import javax.swing.Scrollable;
import javax.swing.SwingConstants; 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.Dimension;
import com.fr.base.BaseUtils; import java.awt.Graphics;
import com.fr.base.GraphHelper; import java.awt.Image;
import com.fr.base.Style; import java.awt.Rectangle;
import com.fr.design.gui.iscrollbar.UIScrollBar; import java.util.ArrayList;
import com.fr.stable.CoreGraphHelper; import java.util.List;
/** /**
* The pane use to preview image * The pane use to preview image
*/ */
public class ImagePreviewPane extends JComponent implements Scrollable { public class ImagePreviewPane extends JComponent implements Scrollable, ImagePreviewer {
private Image image = null; private Image image = null;
// carl:image style // carl:image style
private Style imageStyle = null; private Style imageStyle = null;
private int imageWidth = 0 ; private int imageWidth = 0;
private int imageHeight = 0 ; private int imageHeight = 0;
private boolean isLoading = false;
private List<ChangeListener> changeListenerList = new ArrayList<ChangeListener>(); private List<ChangeListener> changeListenerList = new ArrayList<ChangeListener>();
@ -46,6 +47,12 @@ public class ImagePreviewPane extends JComponent implements Scrollable {
return this.image; return this.image;
} }
public void showLoading() {
isLoading = true;
setImage(null);
repaint();
}
/** /**
* Set image. * Set image.
* *
@ -55,7 +62,7 @@ public class ImagePreviewPane extends JComponent implements Scrollable {
this.image = image; this.image = image;
//need to reset the size of JViewPort. //need to reset the size of JViewPort.
if (this.image == null) { if (this.image == null) {
if(this.getParent() instanceof JViewport) { if (this.getParent() instanceof JViewport) {
UIScrollBar tmpJScrollBar = new UIScrollBar(UIScrollBar.HORIZONTAL); UIScrollBar tmpJScrollBar = new UIScrollBar(UIScrollBar.HORIZONTAL);
Dimension newDimension = new Dimension( Dimension newDimension = new Dimension(
this.getSize().width - tmpJScrollBar.getPreferredSize().height, this.getSize().width - tmpJScrollBar.getPreferredSize().height,
@ -67,6 +74,7 @@ public class ImagePreviewPane extends JComponent implements Scrollable {
} }
} else { } else {
//wait for the size of image. //wait for the size of image.
isLoading = false;
CoreGraphHelper.waitForImage(image); CoreGraphHelper.waitForImage(image);
imageWidth = image.getWidth(null); imageWidth = image.getWidth(null);
@ -83,9 +91,11 @@ public class ImagePreviewPane extends JComponent implements Scrollable {
*/ */
public void paintComponent(Graphics g) { public void paintComponent(Graphics g) {
super.paintComponent(g); super.paintComponent(g);
if (isLoading) {
//draw image. g.drawString(Inter.getLocText("FR-Designer_Image_Loading"), getWidth() / 2 - 25, getHeight() / 2);
if (this.getImage() != null) { return;
}
if (this.getImage() != null) { //draw image.
// carl:让imagePreviewPane能预览样式 // carl:让imagePreviewPane能预览样式
if (this.getImageStyle() == null) { if (this.getImageStyle() == null) {
g.drawImage(this.getImage(), 0, 0, this); g.drawImage(this.getImage(), 0, 0, this);

33
designer_base/src/com/fr/design/style/background/image/ImagePreviewer.java

@ -0,0 +1,33 @@
package com.fr.design.style.background.image;
import com.fr.base.Style;
import java.awt.Image;
/**
* 图片预览接口(由于子类上层父类差别较大,无奈的接口)
* Created by zack on 2018/3/10.
*/
public interface ImagePreviewer {
/**
* 设置图片样式(平铺,拉伸)
* @param style 样式
*/
void setImageStyle(Style style);
/**
* 设置图片
* @param image 图片
*/
void setImage(Image image);
/**
* 显示正在加载
*/
void showLoading();
/**
* 重绘
*/
void repaint();
}

41
designer_base/src/com/fr/design/style/background/image/ImageSelectPane.java

@ -1,28 +1,25 @@
package com.fr.design.style.background.image; package com.fr.design.style.background.image;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import javax.swing.JFileChooser;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import com.fr.base.BaseUtils;
import com.fr.base.background.ImageBackground; import com.fr.base.background.ImageBackground;
import com.fr.design.gui.frpane.ImgChooseWrapper;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.style.AlphaPane;
import com.fr.design.style.background.BackgroundPane4BoxChange;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.CoreGraphHelper;
import com.fr.design.style.AlphaPane; import javax.swing.JFileChooser;
import com.fr.design.style.background.BackgroundPane4BoxChange; import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/** /**
@ -99,18 +96,12 @@ public class ImageSelectPane extends BackgroundPane4BoxChange {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
int returnVal = imageFileChooser.showOpenDialog(ImageSelectPane.this); int returnVal = imageFileChooser.showOpenDialog(ImageSelectPane.this);
if (returnVal != JFileChooser.CANCEL_OPTION) { if (returnVal != JFileChooser.CANCEL_OPTION) {
File selectedFile = imageFileChooser.getSelectedFile(); ImgChooseWrapper.getInstance(selectImage,imageSizeLabel,imageFileChooser).dealWithImageFile(returnVal);
if (selectedFile != null && selectedFile.isFile()) {
Image image = BaseUtils.readImage(selectedFile.getPath());
CoreGraphHelper.waitForImage(image);
selectImage = image;
}
chechLabelText();
} }
} }
}; };
private void chechLabelText() { private void checkLabelText() {
if (selectImage == null) { if (selectImage == null) {
imageSizeLabel.setText(""); imageSizeLabel.setText("");
} else { } else {
@ -133,7 +124,7 @@ public class ImageSelectPane extends BackgroundPane4BoxChange {
} }
chechLabelText(); checkLabelText();
} }
public void populateAlpha(int alpha) { public void populateAlpha(int alpha) {

40
designer_base/src/com/fr/design/style/background/impl/ImageBackgroundPane.java

@ -1,8 +1,8 @@
package com.fr.design.style.background.impl; package com.fr.design.style.background.impl;
import com.fr.base.BaseUtils;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.background.ImageBackground; import com.fr.base.background.ImageBackground;
import com.fr.design.gui.frpane.ImgChooseWrapper;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -13,15 +13,18 @@ import com.fr.design.style.background.image.ImagePreviewPane;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.CoreGraphHelper;
import javax.swing.*; import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
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.BorderLayout;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.io.File;
/** /**
* Image background pane. * Image background pane.
@ -60,7 +63,7 @@ public class ImageBackgroundPane extends BackgroundDetailPane {
imageFileChooser.setMultiSelectionEnabled(false); imageFileChooser.setMultiSelectionEnabled(false);
} }
public JPanel initSelectFilePane(){ public JPanel initSelectFilePane() {
JPanel selectFilePane = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel selectFilePane = FRGUIPaneFactory.createBorderLayout_L_Pane();
selectFilePane.setBorder(BorderFactory.createEmptyBorder(8, 2, 4, 0)); selectFilePane.setBorder(BorderFactory.createEmptyBorder(8, 2, 4, 0));
@ -116,31 +119,12 @@ public class ImageBackgroundPane extends BackgroundDetailPane {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
int returnVal = imageFileChooser.showOpenDialog(ImageBackgroundPane.this); int returnVal = imageFileChooser.showOpenDialog(ImageBackgroundPane.this);
if (returnVal != JFileChooser.CANCEL_OPTION) {
File selectedFile = imageFileChooser.getSelectedFile();
if (selectedFile != null && selectedFile.isFile()) {
Image image = BaseUtils.readImage(selectedFile.getPath());
CoreGraphHelper.waitForImage(image);
previewPane.setImage(image);
imageStyleRepaint();
previewPane.repaint();
} else {
previewPane.setImage(null);
}
}
fireChagneListener();
}
};
public void imageStyleRepaint(){
setImageStyle(); setImageStyle();
previewPane.setImageStyle(imageStyle); ImgChooseWrapper.getInstance(previewPane, imageFileChooser, imageStyle, changeListener).dealWithImageFile(returnVal);
} }
};
private void setImageStyle() { protected void setImageStyle() {
if (tiledRadioButton.isSelected()) { if (tiledRadioButton.isSelected()) {
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_TILED); imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_TILED);
} else if (adjustRadioButton.isSelected()) { } else if (adjustRadioButton.isSelected()) {

13
designer_base/src/com/fr/design/style/background/impl/ImageBackgroundPane4Browser.java

@ -1,10 +1,5 @@
package com.fr.design.style.background.impl; package com.fr.design.style.background.impl;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.stable.ArrayUtils;
import javax.swing.*;
/** /**
* Created by richie on 16/5/18. * Created by richie on 16/5/18.
*/ */
@ -15,12 +10,4 @@ public class ImageBackgroundPane4Browser extends ImageBackgroundPane {
super(); super();
} }
@Override
protected UIRadioButton[] imageLayoutButtons() {
return (UIRadioButton[]) ArrayUtils.addAll(super.imageLayoutButtons(), new UIRadioButton[] {
defaultRadioButton,
tiledRadioButton,
});
}
} }

30
designer_base/src/com/fr/design/style/background/impl/ImageButtonBackgroundPane.java

@ -6,8 +6,11 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import javax.swing.*;
import java.awt.*; import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -18,13 +21,13 @@ public class ImageButtonBackgroundPane extends ImageBackgroundPane {
private UIButton chooseButton; private UIButton chooseButton;
private UIButton clearButton; private UIButton clearButton;
public ImageButtonBackgroundPane(){ public ImageButtonBackgroundPane() {
super(); super();
Style imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_CENTER); Style imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_CENTER);
previewPane.setImageStyle(imageStyle); previewPane.setImageStyle(imageStyle);
} }
public JPanel initSelectFilePane(){ public JPanel initSelectFilePane() {
JPanel choosePane = new JPanel(new BorderLayout(0, 10)); JPanel choosePane = new JPanel(new BorderLayout(0, 10));
choosePane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); choosePane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
@ -33,12 +36,12 @@ public class ImageButtonBackgroundPane extends ImageBackgroundPane {
choosePane.add(chooseButton, BorderLayout.NORTH); choosePane.add(chooseButton, BorderLayout.NORTH);
choosePane1.add(clearButton,BorderLayout.NORTH); choosePane1.add(clearButton, BorderLayout.NORTH);
choosePane.add(choosePane1,BorderLayout.CENTER); choosePane.add(choosePane1, BorderLayout.CENTER);
imageSizeLabel.setHorizontalAlignment(SwingConstants.CENTER); imageSizeLabel.setHorizontalAlignment(SwingConstants.CENTER);
choosePane1.add(imageSizeLabel,BorderLayout.CENTER); choosePane1.add(imageSizeLabel, BorderLayout.CENTER);
this.add(choosePane,BorderLayout.EAST); this.add(choosePane, BorderLayout.EAST);
return choosePane; return choosePane;
} }
@ -55,15 +58,14 @@ public class ImageButtonBackgroundPane extends ImageBackgroundPane {
}); });
} }
public void imageStyleRepaint(){ @Override
protected void setImageStyle() {
} }
public void populate(Background background) { public void populate(Background background) {
if(background != null && background instanceof ImageBackground){ if (background != null && background instanceof ImageBackground) {
ImageBackground imageBackground = (ImageBackground) background; ImageBackground imageBackground = (ImageBackground) background;
if(imageBackground.getImage() != null) { if (imageBackground.getImage() != null) {
previewPane.setImage(imageBackground.getImage()); previewPane.setImage(imageBackground.getImage());
} }
} }
@ -71,7 +73,7 @@ public class ImageButtonBackgroundPane extends ImageBackgroundPane {
} }
public Background update() { public Background update() {
if(previewPane.getImage() == null) { if (previewPane.getImage() == null) {
return null; return null;
} }
return new ImageBackground(previewPane.getImage()); return new ImageBackground(previewPane.getImage());

178
designer_base/src/com/fr/design/utils/ImageUtils.java

@ -0,0 +1,178 @@
package com.fr.design.utils;
import com.fr.base.BaseUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.stable.StringUtils;
import javax.imageio.IIOImage;
import javax.imageio.ImageIO;
import javax.imageio.ImageReader;
import javax.imageio.ImageWriteParam;
import javax.imageio.ImageWriter;
import javax.imageio.stream.ImageInputStream;
import javax.imageio.stream.ImageOutputStream;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.util.Iterator;
/**
* 设计器部分的图片处理工具类
* Created by zack on 2018/3/8.
*/
public class ImageUtils {
/**
* 默认压缩算法,采用75%质量压缩
*
* @param imageFile 原文件
* @return 压缩后的BufferedImage对象
*/
public static BufferedImage defaultImageCompress(File imageFile) {
try {
return imageCompress(imageFile, 0.75f);//默认75%质量
} catch (IOException e) {
FRLogger.getLogger().info("image compress failed!");
}
return BaseUtils.readImage(imageFile.getPath());
}
/**
* 图片压缩
*
* @param imageFile 原文件
* @param quality 质量系数(0-1)
* @return 压缩后的图片
* @throws IOException
*/
public static BufferedImage imageCompress(File imageFile, float quality) throws IOException {
BufferedImage result = BaseUtils.readImage(imageFile.getPath());
if (imageFile == null) {
return null;
}
if (canbeCompressedToJPEG(imageFile)) {
return jpegCompress(result, quality);
}
return result;
}
public static boolean canbeCompressedToJPEG(File imageFile) {
if (ComparatorUtils.equals(getImageType(imageFile), "JPEG")) {//JPEG大写
return true;
}
if (ComparatorUtils.equals(getImageType(imageFile), "png")) {//png小写
return !isAlphaAreaOverload(imageFile);//少量透明度系数的png直接压缩jpg
}
return false;
}
/**
* JPEG格式图片压缩
*
* @param image 压缩源图片
* @param quality 压缩质量在0-1之间
* @return 返回的字节数组
*/
public static BufferedImage jpegCompress(BufferedImage image, float quality) throws IOException {
if (image == null) {
return null;
}
// 得到指定Format图片的writer
Iterator<ImageWriter> iter = ImageIO
.getImageWritersByFormatName("jpeg");// 得到迭代器
ImageWriter writer = iter.next();
// 得到指定writer的输出参数设置(ImageWriteParam )
ImageWriteParam iwp = writer.getDefaultWriteParam();
iwp.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); // 设置可否压缩
iwp.setCompressionQuality(quality); // 设置压缩质量参数
iwp.setProgressiveMode(ImageWriteParam.MODE_DISABLED);
// 开始打包图片,写入byte[]
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
ImageOutputStream ios = null;
ByteArrayInputStream in = null;
try {
image = copy(image, BufferedImage.TYPE_INT_RGB);
ios = ImageIO.createImageOutputStream(byteArrayOutputStream);
writer.setOutput(ios);
writer.write(null, new IIOImage(image, null, null), iwp);
in = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
if (ios == null || in == null) {
throw new IOException("The image file cannot be compressed");
}
return ImageIO.read(in);
} finally {
writer.dispose();
ios.close();
byteArrayOutputStream.close();
in.close();
}
}
/**
* 判断图片中是否包含多于5%的透明区域,这个5%随便定的
*
* @param imageFile 目标图片
* @return 含透明度像素占比
*/
public static boolean isAlphaAreaOverload(File imageFile) {
if (imageFile == null || !imageFile.isFile()) {
return false;
}
BufferedImage bufferedImage = BaseUtils.readImage(imageFile.getPath());
int width = bufferedImage.getWidth();
int height = bufferedImage.getHeight();
long alphaCount = 0;
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
int rgb = bufferedImage.getRGB(i, j);
int a = (0xff & (rgb >> 24));
if (a != 0xff) {
alphaCount++;
}
}
}
return alphaCount / (double) (width * height) > 0.05;
}
/**
* 获取图片类型
*
* @param imageFile 图片文件
* @return 图片类型(JPEG, PNG, GIF)
*/
public static String getImageType(File imageFile) {
try {
ImageInputStream iis = ImageIO.createImageInputStream(imageFile);
Iterator<ImageReader> iter = ImageIO.getImageReaders(iis);
if (!iter.hasNext()) {
return StringUtils.EMPTY;
}
ImageReader reader = iter.next();
iis.close();
return reader.getFormatName();
} catch (IOException ignore) {
}
return StringUtils.EMPTY;
}
private static BufferedImage copy(BufferedImage img, int imageType) {
int width = img.getWidth();
int height = img.getHeight();
BufferedImage newImage = new BufferedImage(width, height, imageType);
Graphics g = newImage.createGraphics();
g.drawImage(img, 0, 0, null);
g.dispose();
return newImage;
}
}

48
designer_base/src/com/fr/design/utils/gui/GUICoreUtils.java

@ -12,6 +12,7 @@ import com.fr.design.actions.core.ActionFactory;
import com.fr.design.border.UITitledBorder; import com.fr.design.border.UITitledBorder;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.EditTextField; import com.fr.design.gui.itextfield.EditTextField;
@ -37,6 +38,7 @@ import javax.swing.tree.TreePath;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.awt.image.ImageObserver; import java.awt.image.ImageObserver;
@ -844,4 +846,50 @@ public abstract class GUICoreUtils{
&& oneRect.getWidth() == otherRect.getWidth() && oneRect.getWidth() == otherRect.getWidth()
&& oneRect.getHeight() == otherRect.getHeight(); && oneRect.getHeight() == otherRect.getHeight();
} }
/**
* 生成提示标签
* @param tipText 提示文字
* @return UILabel 标签对象
*/
public static UILabel createTipLabel(String tipText) {
UILabel tipLabel = new UILabel("<html>" + tipText + "</html>");
tipLabel.setForeground(Color.gray);
return tipLabel;
}
/**
* 生成没有边框的 UICheckBox
* @param text 说明文字
* @return UICheckBox
*/
public static UICheckBox createNoBorderCheckBox(String text) {
UICheckBox checkBox = new UICheckBox(text);
checkBox.setBorder(BorderFactory.createEmptyBorder());
return checkBox;
}
/**
* 创建包含选择框和一个动态面板的联动面板根据选择框的状态动态面板会动态地显示或隐藏
* @param checkBox 选择框
* @param dynamicPane 包含任意内容的动态面板
* @param hideOnSelected 选中时隐藏动态面板若为false则在"去掉勾选"时隐藏动态面板
* @return 联动面板
*/
public static JPanel createCheckboxAndDynamicPane(UICheckBox checkBox, final JPanel dynamicPane, final boolean hideOnSelected) {
checkBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
int visibleState = hideOnSelected ? ItemEvent.DESELECTED : ItemEvent.SELECTED;
dynamicPane.setVisible(e.getStateChange() == visibleState);
}
});
JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane();
panel.add(checkBox, BorderLayout.NORTH);
JPanel dynamicPaneWrapper = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
dynamicPaneWrapper.add(dynamicPane);
panel.add(dynamicPaneWrapper, BorderLayout.CENTER);
return panel;
}
} }

35
designer_chart/src/com/fr/design/module/ChartEmptyDataStylePane.java

@ -13,6 +13,7 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.style.background.image.ImageFileChooser; import com.fr.design.style.background.image.ImageFileChooser;
import com.fr.design.style.background.image.ImagePreviewPane; import com.fr.design.style.background.image.ImagePreviewPane;
import com.fr.design.utils.ImageUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
@ -21,20 +22,21 @@ import com.fr.general.Inter;
import com.fr.stable.CoreGraphHelper; import com.fr.stable.CoreGraphHelper;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JFileChooser; import javax.swing.JFileChooser;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.ButtonGroup; import javax.swing.SwingWorker;
import java.awt.Image; import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridLayout; import java.awt.GridLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
/** /**
* Created by mengao on 2017/11/23. * Created by mengao on 2017/11/23.
@ -57,6 +59,7 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane {
private ImageFileChooser imageFileChooser; private ImageFileChooser imageFileChooser;
private Image emptyDataImage = DEFAULT_EMPTY_DATA_IMAGE; private Image emptyDataImage = DEFAULT_EMPTY_DATA_IMAGE;
private SwingWorker<Void, Void> imageWorker;
static { static {
@ -161,13 +164,23 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
int returnVal = imageFileChooser.showOpenDialog(ChartEmptyDataStylePane.this); int returnVal = imageFileChooser.showOpenDialog(ChartEmptyDataStylePane.this);
if (returnVal != JFileChooser.CANCEL_OPTION) { if (returnVal != JFileChooser.CANCEL_OPTION) {
File selectedFile = imageFileChooser.getSelectedFile(); final File selectedFile = imageFileChooser.getSelectedFile();
if (selectedFile != null && selectedFile.isFile()) { if (selectedFile != null && selectedFile.isFile()) {
emptyDataImage = BaseUtils.readImage(selectedFile.getPath()); previewPane.showLoading();
if (imageWorker != null && !imageWorker.isDone()) {
imageWorker = null;
}
imageWorker = new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
emptyDataImage = imageFileChooser.isCheckSelected() ? ImageUtils.defaultImageCompress(selectedFile) : BaseUtils.readImage(selectedFile.getPath());
CoreGraphHelper.waitForImage(emptyDataImage); CoreGraphHelper.waitForImage(emptyDataImage);
repaintPreviewPane(); repaintPreviewPane();
return null;
}
};
imageWorker.execute();
} else { } else {
previewPane.setImage(null); previewPane.setImage(null);
} }

18
designer_chart/src/com/fr/plugin/chart/designer/other/VanChartInteractivePane.java

@ -28,6 +28,8 @@ import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
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;
@ -163,6 +165,12 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
} }
axisRotation = new UIButtonGroup<Integer>(new String[]{Inter.getLocText("Plugin-ChartF_Open"), axisRotation = new UIButtonGroup<Integer>(new String[]{Inter.getLocText("Plugin-ChartF_Open"),
Inter.getLocText("Plugin-ChartF_Close")}); Inter.getLocText("Plugin-ChartF_Close")});
axisRotation.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
checkZoomEnabled();
}
});
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null,null}, new Component[]{null,null},
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Reversal")),axisRotation} new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Reversal")),axisRotation}
@ -171,6 +179,14 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Inter.getLocText("Plugin-ChartF_Axis"), panel); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Inter.getLocText("Plugin-ChartF_Axis"), panel);
} }
private void checkZoomEnabled() {
if (zoomWidget != null && axisRotation != null) {
zoomWidget.setSelectedIndex(1);
checkZoomPane();
zoomWidget.setEnabled(axisRotation.getSelectedIndex() == 1);
}
}
protected String[] getNameArray() { protected String[] getNameArray() {
return new String[]{Inter.getLocText("ChartF-X_Axis"), Inter.getLocText("ChartF-Y_Axis") return new String[]{Inter.getLocText("ChartF-X_Axis"), Inter.getLocText("ChartF-Y_Axis")
,Inter.getLocText("Plugin-ChartF_XYAxis"),Inter.getLocText("Chart-Use_None")}; ,Inter.getLocText("Plugin-ChartF_XYAxis"),Inter.getLocText("Chart-Use_None")};
@ -273,6 +289,8 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
populateAutoRefresh((VanChart)chart); populateAutoRefresh((VanChart)chart);
populateHyperlink(plot); populateHyperlink(plot);
checkZoomEnabled();
} }

9
designer_form/src/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java

@ -811,7 +811,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
if (ry != y) { if (ry != y) {
calculateNoRelatedWhileRightTop(rec, rightComp); calculateNoRelatedWhileRightTop(rec, rightComp);
} else { } else {
calculateNoRelatedWhileRightBott(rec, rightComp); calculateNoRelatedWhileRightBott(rec);
} }
} }
@ -856,8 +856,11 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
recalculateChildrenSize(bound.x, bound.y, bound.width, bound.height, true); recalculateChildrenSize(bound.x, bound.y, bound.width, bound.height, true);
} }
private void calculateNoRelatedWhileRightBott(Rectangle bound, Component rcomp) { private void calculateNoRelatedWhileRightBott(Rectangle bound) {
rcomp = container.getBottomRightComp(bound.x, bound.y, bound.height, bound.width); Component rcomp = container.getBottomRightComp(bound.x, bound.y, bound.height, bound.width);
if(rcomp == null){
return;
}
int ry = rcomp.getY(); int ry = rcomp.getY();
int rh = rcomp.getHeight(); int rh = rcomp.getHeight();
int rw = rcomp.getWidth(); int rw = rcomp.getWidth();

13
designer_form/src/com/fr/design/designer/beans/models/SelectionModel.java

@ -65,6 +65,19 @@ public class SelectionModel {
if (e.getButton() == MouseEvent.BUTTON3 || (!InputEventBaseOnOS.isControlDown(e) && !e.isShiftDown())) { if (e.getButton() == MouseEvent.BUTTON3 || (!InputEventBaseOnOS.isControlDown(e) && !e.isShiftDown())) {
// 如果Ctrl或者Shift键盘没有按下,则清除已经选择的组件 // 如果Ctrl或者Shift键盘没有按下,则清除已经选择的组件
selection.reset(); selection.reset();
} else {
//按下Ctrl或者shift键时鼠标可以进行多选,两次点击同一控件就取消选中
XCreator comp = designer.getComponentAt(e);
XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer(comp).getTopLayout();
if (topLayout != null && !topLayout.isEditable()) {
comp = topLayout;
}
XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(comp);
for (XCreator selected : selection.getSelectedCreators()) {
if (selected == comp || XCreatorUtils.getParentXLayoutContainer(selected) != container) {
selection.removeCreator(selected);
}
}
} }
// 获取e所在的组件 // 获取e所在的组件
XCreator comp = designer.getComponentAt(e); XCreator comp = designer.getComponentAt(e);

7
designer_form/src/com/fr/design/designer/creator/XChartEditor.java

@ -47,7 +47,6 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
private boolean isEditing = false; private boolean isEditing = false;
private boolean isHovering = false; private boolean isHovering = false;
private JPanel coverPanel;
private static final Color OUTER_BORDER_COLOR = new Color(65, 155, 249, 30); private static final Color OUTER_BORDER_COLOR = new Color(65, 155, 249, 30);
private static final Color INNER_BORDER_COLOR = new Color(65, 155, 249); private static final Color INNER_BORDER_COLOR = new Color(65, 155, 249);
@ -247,6 +246,10 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
editingMouseListener.startEditing(this, isEditing ? adapter.getDesignerEditor() : null, adapter); editingMouseListener.startEditing(this, isEditing ? adapter.getDesignerEditor() : null, adapter);
} }
} }
HelpDialogManager.getInstance().setPane(coverPanel);
if (this.isHelpBtnOnFocus()) {
coverPanel.setMsgDisplay(e);
}
} }
@Override @Override
@ -275,7 +278,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
editor.setLayout(null); editor.setLayout(null);
editor.setOpaque(false); editor.setOpaque(false);
coverPanel = new CoverPane(); coverPanel = new CoverReportPane();
coverPanel.setPreferredSize(this.getPreferredSize()); coverPanel.setPreferredSize(this.getPreferredSize());
coverPanel.setBounds(this.getBounds()); coverPanel.setBounds(this.getBounds());

29
designer_form/src/com/fr/design/designer/creator/XCreator.java

@ -15,6 +15,7 @@ import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.AuthorityPropertyPane; import com.fr.design.mainframe.AuthorityPropertyPane;
import com.fr.design.mainframe.BaseJForm; import com.fr.design.mainframe.BaseJForm;
import com.fr.design.mainframe.CoverReportPane;
import com.fr.design.mainframe.EditingMouseListener; import com.fr.design.mainframe.EditingMouseListener;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.NoSupportAuthorityEdit; import com.fr.design.mainframe.NoSupportAuthorityEdit;
@ -58,6 +59,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
protected Widget data; protected Widget data;
protected JComponent editor; protected JComponent editor;
protected CoverReportPane coverPanel;
// XCreator加入到某些XLayoutContainer中时,能调整宽度或者高度 // XCreator加入到某些XLayoutContainer中时,能调整宽度或者高度
private int[] directions; private int[] directions;
private Rectangle backupBound; private Rectangle backupBound;
@ -635,7 +637,31 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
* 设置描述信息 * 设置描述信息
* @param msg 帮助信息 * @param msg 帮助信息
*/ */
public void setXDescrption(String msg){} public void setXDescrption(String msg){
if (coverPanel != null) {
coverPanel.setHelpMsg(msg);
}
}
public JComponent getCoverPane(){
return coverPanel;
}
/**
* 销毁帮助提示框
*/
public void destroyHelpDialog(){
if (coverPanel != null) {
coverPanel.destroyHelpDialog();
}
}
/**
* 是否展现覆盖的pane
* @param display 是否
*/
public void displayCoverPane(boolean display){
}
/** /**
* 根据widget设置Xcreator描述信息 * 根据widget设置Xcreator描述信息
@ -645,7 +671,6 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
if (widget != null) { if (widget != null) {
setXDescrption(widget.getDescription()); setXDescrption(widget.getDescription());
} }
} }
/** /**

20
designer_form/src/com/fr/design/designer/creator/XElementCase.java

@ -1,7 +1,6 @@
package com.fr.design.designer.creator; package com.fr.design.designer.creator;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.GraphHelper;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.designer.properties.mobile.ElementCasePropertyUI; import com.fr.design.designer.properties.mobile.ElementCasePropertyUI;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
@ -21,7 +20,6 @@ import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.ui.ElementCaseEditorProvider; import com.fr.form.ui.ElementCaseEditorProvider;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.Constants;
import com.fr.stable.CoreGraphHelper; import com.fr.stable.CoreGraphHelper;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
import com.fr.stable.fun.FitProvider; import com.fr.stable.fun.FitProvider;
@ -37,7 +35,6 @@ import java.util.Set;
public class XElementCase extends XBorderStyleWidgetCreator implements FormElementCaseContainerProvider{ public class XElementCase extends XBorderStyleWidgetCreator implements FormElementCaseContainerProvider{
private UILabel imageLable; private UILabel imageLable;
private CoverReportPane coverPanel;
private FormDesigner designer; private FormDesigner designer;
private static BufferedImage DEFAULT_BACKGROUND; private static BufferedImage DEFAULT_BACKGROUND;
private boolean isHovering = false; private boolean isHovering = false;
@ -232,18 +229,6 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
} }
} }
/**
* 销毁帮助提示框
*/
public void destroyHelpDialog(){
coverPanel.destroyHelpDialog();
}
public JComponent getCoverPane(){
return coverPanel;
}
/** /**
* 初始化大小 * 初始化大小
* @return 尺寸 * @return 尺寸
@ -332,11 +317,6 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
return new WidgetPropertyUIProvider[]{ new ElementCasePropertyUI(this)}; return new WidgetPropertyUIProvider[]{ new ElementCasePropertyUI(this)};
} }
@Override
public void setXDescrption(String msg) {
coverPanel.setHelpMsg(msg);
}
/** /**
* data属性改变触发其他操作 * data属性改变触发其他操作
* *

39
designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java

@ -4,6 +4,8 @@
package com.fr.design.designer.creator; package com.fr.design.designer.creator;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.base.iofileattr.SharableAttrMark;
import com.fr.design.constants.UIConstants;
import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.LayoutAdapter;
@ -14,9 +16,12 @@ import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.form.layout.FRAbsoluteLayout; import com.fr.design.form.layout.FRAbsoluteLayout;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.icon.IconPathConstants; import com.fr.design.icon.IconPathConstants;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.EditingMouseListener; import com.fr.design.mainframe.EditingMouseListener;
import com.fr.design.mainframe.FormArea; import com.fr.design.mainframe.FormArea;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetHelpDialog;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.form.ui.Connector; import com.fr.form.ui.Connector;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WAbsoluteLayout;
@ -25,6 +30,7 @@ import com.fr.form.ui.container.WLayout;
import com.fr.general.FRScreen; import com.fr.general.FRScreen;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.share.ShareConstants;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import java.awt.*; import java.awt.*;
@ -34,6 +40,7 @@ import java.awt.image.BufferedImage;
import java.beans.IntrospectionException; import java.beans.IntrospectionException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import javax.swing.Icon;
/** /**
* @author richer * @author richer
@ -41,17 +48,20 @@ import java.util.HashMap;
*/ */
public class XWAbsoluteLayout extends XLayoutContainer { public class XWAbsoluteLayout extends XLayoutContainer {
private static final int EDIT_BTN_WIDTH = 60; private static final int EDIT_BTN_WIDTH = 75;
private static final int EDIT_BTN_HEIGHT = 24; private static final int EDIT_BTN_HEIGHT = 20;
private int minWidth = WLayout.MIN_WIDTH; private int minWidth = WLayout.MIN_WIDTH;
private int minHeight = WLayout.MIN_HEIGHT; private int minHeight = WLayout.MIN_HEIGHT;
private static final Color OUTER_BORDER_COLOR = new Color(65, 155, 249, 30); private static final Color OUTER_BORDER_COLOR = new Color(65, 155, 249, 30);
private static final Color INNER_BORDER_COLOR = new Color(65, 155, 249); private static final Color INNER_BORDER_COLOR = new Color(65, 155, 249);
private static final int BORDER_WIDTH = 1; private static final int BORDER_WIDTH = 1;
private Icon controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH);
//由于屏幕分辨率不同,界面上的容器大小可能不是默认的100%,此时拖入组件时,保存的大小按照100%时的计算 //由于屏幕分辨率不同,界面上的容器大小可能不是默认的100%,此时拖入组件时,保存的大小按照100%时的计算
protected double containerPercent = 1.0; protected double containerPercent = 1.0;
private boolean isHovering = false;
private HashMap<Connector, XConnector> xConnectorMap; private HashMap<Connector, XConnector> xConnectorMap;
public XWAbsoluteLayout() { public XWAbsoluteLayout() {
@ -442,9 +452,12 @@ public class XWAbsoluteLayout extends XLayoutContainer {
g2d.setColor(XCreatorConstants.COVER_COLOR); g2d.setColor(XCreatorConstants.COVER_COLOR);
g2d.fillRect(x, y, w, h); g2d.fillRect(x, y, w, h);
//画编辑按钮所在框 //画编辑按钮所在框
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
AlphaComposite alphaComposite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, formDesigner.getCursor().getType() != Cursor.DEFAULT_CURSOR ? 0.9f : 0.7f);
g2d.setColor(XCreatorConstants.EDIT_COLOR);
g2d.setComposite(alphaComposite);
g2d.fillRoundRect((x + w / 2 - EDIT_BTN_WIDTH / 2), (y + h / 2 - EDIT_BTN_HEIGHT / 2), EDIT_BTN_WIDTH, EDIT_BTN_HEIGHT, 4, 4);
g2d.setComposite(oldComposite); g2d.setComposite(oldComposite);
g2d.setColor(new Color(176, 196, 222));
g2d.fillRect((x + w / 2 - EDIT_BTN_WIDTH / 2), (y + h / 2 - EDIT_BTN_HEIGHT / 2), EDIT_BTN_WIDTH, EDIT_BTN_HEIGHT);
//画编辑按钮图标 //画编辑按钮图标
BufferedImage image = IOUtils.readImage(IconPathConstants.EDIT_ICON_PATH); BufferedImage image = IOUtils.readImage(IconPathConstants.EDIT_ICON_PATH);
g2d.drawImage( g2d.drawImage(
@ -456,13 +469,24 @@ public class XWAbsoluteLayout extends XLayoutContainer {
null, null,
this this
); );
g2d.setColor(Color.BLACK); g2d.setColor(Color.WHITE);
//画编辑文字 //画编辑文字
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.drawString(Inter.getLocText("FR-Designer_Edit"), x + w / 2 - 2, y + h / 2 + 5); g2d.drawString(Inter.getLocText("FR-Designer_Edit"), x + w / 2 - 2, y + h / 2 + 5);
g.setColor(XCreatorConstants.FORM_BORDER_COLOR); g.setColor(XCreatorConstants.FORM_BORDER_COLOR);
GraphHelper.draw(g, new Rectangle(BORDER_WIDTH, BORDER_WIDTH, getWidth() - BORDER_WIDTH * 2, getHeight() - BORDER_WIDTH * 2), Constants.LINE_MEDIUM); GraphHelper.draw(g, new Rectangle(BORDER_WIDTH, BORDER_WIDTH, getWidth() - BORDER_WIDTH * 2, getHeight() - BORDER_WIDTH * 2), Constants.LINE_MEDIUM);
paintExtro(g);
}
} }
public void paintExtro(Graphics g) {
if (this.toData().getWidgetAttrMark(SharableAttrMark.XML_TAG) != null) {
int width = getWidth() - ShareConstants.SHARE_EL_CONTROL_BUTTON_HW;
g.setColor(UIConstants.NORMAL_BACKGROUND);
g.fillArc(width, 0, ShareConstants.SHARE_EL_CONTROL_BUTTON_HW, ShareConstants.SHARE_EL_CONTROL_BUTTON_HW,
0, 360);
controlMode.paintIcon(this, g, width, 0);
}
} }
@Override @Override
@ -483,6 +507,11 @@ public class XWAbsoluteLayout extends XLayoutContainer {
* @param e 鼠标点击事件 * @param e 鼠标点击事件
*/ */
public void respondClick(EditingMouseListener editingMouseListener, MouseEvent e) { public void respondClick(EditingMouseListener editingMouseListener, MouseEvent e) {
//帮助弹窗
if (this.isHelpBtnOnFocus()) {
new WidgetHelpDialog(DesignerContext.getDesignerFrame(), this.toData().getDescription()).showWindow(e);
return;
}
FormDesigner designer = editingMouseListener.getDesigner(); FormDesigner designer = editingMouseListener.getDesigner();
SelectionModel selectionModel = editingMouseListener.getSelectionModel(); SelectionModel selectionModel = editingMouseListener.getSelectionModel();
boolean isEditing = isEditable() || boolean isEditing = isEditable() ||

3
designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java

@ -5,6 +5,7 @@ package com.fr.design.designer.creator.cardlayout;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.base.background.ColorBackground;
import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.beans.models.SelectionModel;
@ -322,7 +323,7 @@ public class XCardSwitchButton extends XButton {
//画背景 //画背景
private void drawBackground(CardSwitchButton button, WidgetTitle widgetTitle){ private void drawBackground(CardSwitchButton button, WidgetTitle widgetTitle){
Background background = widgetTitle.getBackground(); Background background = widgetTitle.getBackground() == null ? ColorBackground.getInstance(NORMAL_GRAL) : widgetTitle.getBackground();
TemplateStyle templateStyle = ((WCardTagLayout) tagLayout.toData()).getTemplateStyle(); TemplateStyle templateStyle = ((WCardTagLayout) tagLayout.toData()).getTemplateStyle();
//获取当前tab的index //获取当前tab的index
CardSwitchButton currentButton = (CardSwitchButton) this.toData(); CardSwitchButton currentButton = (CardSwitchButton) this.toData();

39
designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java

@ -4,6 +4,8 @@
package com.fr.design.designer.creator.cardlayout; package com.fr.design.designer.creator.cardlayout;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.base.iofileattr.SharableAttrMark;
import com.fr.design.constants.UIConstants;
import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.LayoutAdapter;
@ -16,8 +18,11 @@ import com.fr.design.designer.creator.XWBorderLayout;
import com.fr.design.designer.creator.XWidgetCreator; import com.fr.design.designer.creator.XWidgetCreator;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.icon.IconPathConstants; import com.fr.design.icon.IconPathConstants;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.EditingMouseListener; import com.fr.design.mainframe.EditingMouseListener;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetHelpDialog;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.form.event.Listener; import com.fr.form.event.Listener;
import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
@ -32,6 +37,7 @@ import com.fr.form.ui.container.cardlayout.WCardTitleLayout;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.share.ShareConstants;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import java.awt.AlphaComposite; import java.awt.AlphaComposite;
@ -43,10 +49,12 @@ import java.awt.Dimension;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.swing.Icon;
/** /**
* card布局主体框架 * card布局主体框架
@ -57,12 +65,13 @@ import java.util.List;
*/ */
public class XWCardMainBorderLayout extends XWBorderLayout{ public class XWCardMainBorderLayout extends XWBorderLayout{
private Icon controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH);
private static final int CENTER = 1; private static final int CENTER = 1;
private static final int NORTH = 0; private static final int NORTH = 0;
private static final int TITLE_STYLE = 2; private static final int TITLE_STYLE = 2;
private static final int EDIT_BTN_WIDTH = 60; private static final int EDIT_BTN_WIDTH = 75;
private static final int EDIT_BTN_HEIGHT = 24; private static final int EDIT_BTN_HEIGHT = 20;
private static final int BORDER_WIDTH = 1; private static final int BORDER_WIDTH = 1;
private final int CARDMAINLAYOUT_CHILD_COUNT = 1; private final int CARDMAINLAYOUT_CHILD_COUNT = 1;
@ -337,9 +346,12 @@ public class XWCardMainBorderLayout extends XWBorderLayout{
g2d.setColor(XCreatorConstants.COVER_COLOR); g2d.setColor(XCreatorConstants.COVER_COLOR);
g2d.fillRect(x, y, w, h); g2d.fillRect(x, y, w, h);
//画编辑按钮所在框 //画编辑按钮所在框
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
AlphaComposite alphaComposite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, formDesigner.getCursor().getType() != Cursor.DEFAULT_CURSOR ? 0.9f : 0.7f);
g2d.setColor(XCreatorConstants.EDIT_COLOR);
g2d.setComposite(alphaComposite);
g2d.fillRoundRect((x + w / 2 - EDIT_BTN_WIDTH / 2), (y + h / 2 - EDIT_BTN_HEIGHT / 2), EDIT_BTN_WIDTH, EDIT_BTN_HEIGHT, 4, 4);
g2d.setComposite(oldComposite); g2d.setComposite(oldComposite);
g2d.setColor(new Color(176, 196, 222));
g2d.fillRect((x + w / 2 - EDIT_BTN_WIDTH / 2), (y + h / 2 - EDIT_BTN_HEIGHT / 2), EDIT_BTN_WIDTH, EDIT_BTN_HEIGHT);
//画编辑按钮图标 //画编辑按钮图标
BufferedImage image = IOUtils.readImage(IconPathConstants.EDIT_ICON_PATH); BufferedImage image = IOUtils.readImage(IconPathConstants.EDIT_ICON_PATH);
g2d.drawImage( g2d.drawImage(
@ -351,11 +363,23 @@ public class XWCardMainBorderLayout extends XWBorderLayout{
null, null,
this this
); );
g2d.setColor(Color.BLACK); g2d.setColor(Color.WHITE);
//画编辑文字 //画编辑文字
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.drawString(Inter.getLocText("FR-Designer_Edit"), x + w / 2 - 2, y + h / 2 + 5); g2d.drawString(Inter.getLocText("FR-Designer_Edit"), x + w / 2 - 2, y + h / 2 + 5);
g.setColor(XCreatorConstants.FORM_BORDER_COLOR); g.setColor(XCreatorConstants.FORM_BORDER_COLOR);
GraphHelper.draw(g, new Rectangle(BORDER_WIDTH, BORDER_WIDTH, getWidth() - BORDER_WIDTH * 2, getHeight() - BORDER_WIDTH * 2), Constants.LINE_MEDIUM); GraphHelper.draw(g, new Rectangle(BORDER_WIDTH, BORDER_WIDTH, getWidth() - BORDER_WIDTH * 2, getHeight() - BORDER_WIDTH * 2), Constants.LINE_MEDIUM);
paintExtro(g);
}
}
public void paintExtro(Graphics g) {
if (this.toData().getWidgetAttrMark(SharableAttrMark.XML_TAG) != null) {
int width = getWidth() - ShareConstants.SHARE_EL_CONTROL_BUTTON_HW;
g.setColor(UIConstants.NORMAL_BACKGROUND);
g.fillArc(width, 0, ShareConstants.SHARE_EL_CONTROL_BUTTON_HW, ShareConstants.SHARE_EL_CONTROL_BUTTON_HW,
0, 360);
controlMode.paintIcon(this, g, width, 0);
} }
} }
@ -374,6 +398,11 @@ public class XWCardMainBorderLayout extends XWBorderLayout{
*/ */
@Override @Override
public void respondClick(EditingMouseListener editingMouseListener, MouseEvent e){ public void respondClick(EditingMouseListener editingMouseListener, MouseEvent e){
//帮助弹窗
if (this.isHelpBtnOnFocus()) {
new WidgetHelpDialog(DesignerContext.getDesignerFrame(), this.toData().getDescription()).showWindow(e);
return;
}
FormDesigner designer = editingMouseListener.getDesigner(); FormDesigner designer = editingMouseListener.getDesigner();
SelectionModel selectionModel = editingMouseListener.getSelectionModel(); SelectionModel selectionModel = editingMouseListener.getSelectionModel();
boolean isEditing = e.getButton() == MouseEvent.BUTTON1 && boolean isEditing = e.getButton() == MouseEvent.BUTTON1 &&

2
designer_form/src/com/fr/design/form/util/XCreatorConstants.java

@ -45,6 +45,8 @@ public class XCreatorConstants {
public static final Color LAYOUT_SEP_COLOR = new Color(210, 210, 210); public static final Color LAYOUT_SEP_COLOR = new Color(210, 210, 210);
// 组件覆盖层颜色 // 组件覆盖层颜色
public static final Color COVER_COLOR = new Color(216, 242, 253); public static final Color COVER_COLOR = new Color(216, 242, 253);
//组件编辑按钮颜色
public static final Color EDIT_COLOR = new Color(51, 51, 52);
// 伸缩表单操作条的颜色 // 伸缩表单操作条的颜色
public static final Color OP_COLOR = new Color(157,228,245); public static final Color OP_COLOR = new Color(157,228,245);

34
designer_form/src/com/fr/design/mainframe/CoverPane.java

@ -4,13 +4,23 @@ import com.fr.base.GraphHelper;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.icon.IconPathConstants; import com.fr.design.icon.IconPathConstants;
import com.fr.design.utils.ComponentUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import javax.swing.*; import javax.swing.JPanel;
import java.awt.*; import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Component;
import java.awt.Composite;
import java.awt.Container;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.LayoutManager;
import java.awt.Rectangle;
/** /**
* Created with IntelliJ IDEA. * Created with IntelliJ IDEA.
@ -21,9 +31,11 @@ import java.awt.*;
public class CoverPane extends JPanel { public class CoverPane extends JPanel {
private UIButton editButton; private UIButton editButton;
private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 50 / 100.0F); private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f);
private static final int BORDER_WIDTH = 2; private static final int BORDER_WIDTH = 2;
private static final Color COVER_COLOR = new Color(216, 242, 253); private static final Color COVER_COLOR = new Color(216, 242, 253);
private static final int EDIT_BTN_WIDTH = 75;
private static final int EDIT_BTN_HEIGHT = 20;
public CoverPane() { public CoverPane() {
setLayout(getCoverLayout()); setLayout(getCoverLayout());
@ -38,7 +50,7 @@ public class CoverPane extends JPanel {
}; };
editButton.setBorderPainted(false); editButton.setBorderPainted(false);
editButton.setExtraPainted(false); editButton.setExtraPainted(false);
editButton.setBackground(new Color(176, 196, 222)); editButton.setForeground(Color.WHITE);
add(editButton); add(editButton);
} }
@ -92,14 +104,26 @@ public class CoverPane extends JPanel {
public void paint(Graphics g) { public void paint(Graphics g) {
int x = 0;
int y = 0;
int w = getWidth();
int h = getHeight();
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
Composite oldComposite = g2d.getComposite(); Composite oldComposite = g2d.getComposite();
g2d.setComposite(composite); g2d.setComposite(composite);
g2d.setColor(COVER_COLOR); g2d.setColor(COVER_COLOR);
g2d.fillRect(0, 0, getWidth(), getHeight()); g2d.fillRect(0, 0, getWidth(), getHeight());
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
g2d.setColor(XCreatorConstants.EDIT_COLOR);
boolean editHover = formDesigner.getCursor().getType() != Cursor.DEFAULT_CURSOR;
AlphaComposite alphaComposite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, editHover ? 0.9f : 0.7f);
g2d.setComposite(alphaComposite);
g2d.fillRoundRect((x + w / 2 - EDIT_BTN_WIDTH / 2), (y + h / 2 - EDIT_BTN_HEIGHT / 2), EDIT_BTN_WIDTH, EDIT_BTN_HEIGHT, 4, 4);
g2d.setComposite(oldComposite); g2d.setComposite(oldComposite);
g.setColor(XCreatorConstants.FORM_BORDER_COLOR); g.setColor(XCreatorConstants.FORM_BORDER_COLOR);
GraphHelper.draw(g, getPaintBorderBounds(), Constants.LINE_MEDIUM); GraphHelper.draw(g, getPaintBorderBounds(), Constants.LINE_MEDIUM);
super.paint(g); super.paint(g);
} }

4
designer_form/src/com/fr/design/mainframe/CoverReportPane.java

@ -35,7 +35,7 @@ public class CoverReportPane extends CoverPane implements HelpDialogHandler{
private String helpMsg;//帮助信息(后续帮助信息可能会变成标配,就直接放这边了) private String helpMsg;//帮助信息(后续帮助信息可能会变成标配,就直接放这边了)
private ElementCaseHelpDialog helpDialog = null; private WidgetHelpDialog helpDialog = null;
public CoverReportPane() { public CoverReportPane() {
this(StringUtils.EMPTY); this(StringUtils.EMPTY);
@ -62,7 +62,7 @@ public class CoverReportPane extends CoverPane implements HelpDialogHandler{
if (helpDialog == null) { if (helpDialog == null) {
// controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_CLOSE_ICON_PATH); // controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_CLOSE_ICON_PATH);
controlButton.setVisible(false); controlButton.setVisible(false);
helpDialog = new ElementCaseHelpDialog(DesignerContext.getDesignerFrame(), helpMsg); helpDialog = new WidgetHelpDialog(DesignerContext.getDesignerFrame(), helpMsg);
double screenValue = FRScreen.getByDimension(Toolkit.getDefaultToolkit().getScreenSize()).getValue(); double screenValue = FRScreen.getByDimension(Toolkit.getDefaultToolkit().getScreenSize()).getValue();
int offsetX = 0; int offsetX = 0;
if (screenValue < FormArea.DEFAULT_SLIDER) { if (screenValue < FormArea.DEFAULT_SLIDER) {

57
designer_form/src/com/fr/design/mainframe/EditingMouseListener.java

@ -22,8 +22,10 @@ import com.fr.design.utils.ComponentUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.LayoutUtils; import com.fr.design.utils.gui.LayoutUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.share.ShareConstants;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.MouseInputAdapter; import javax.swing.event.MouseInputAdapter;
import java.awt.*; import java.awt.*;
@ -260,7 +262,7 @@ public class EditingMouseListener extends MouseInputAdapter {
public void mouseMoved(MouseEvent e) { public void mouseMoved(MouseEvent e) {
XCreator component = designer.getComponentAt(e); XCreator component = designer.getComponentAt(e);
setCoverPaneNotDisplay(e, false); setCoverPaneNotDisplay(component, e, false);
if (processTopLayoutMouseMove(component, e)) { if (processTopLayoutMouseMove(component, e)) {
return; return;
@ -313,23 +315,42 @@ public class EditingMouseListener extends MouseInputAdapter {
designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
} }
} }
xElementCase.setHelpBtnOnFocus(false); setHelpBtnFocus(e, xElementCase);
if (xElementCase.getCoverPane().getComponentCount() > 1) { }
JComponent button1 = (JComponent) xElementCase.getCoverPane().getComponent(1);
private void setHelpBtnFocus(MouseEvent e, XCreator component) {
component.setHelpBtnOnFocus(false);
if (component.getCoverPane() != null) {
if (component.getCoverPane().getComponentCount() > 1) {
JComponent button1 = (JComponent) component.getCoverPane().getComponent(1);
int minX1 = button1.getX() + getParentPositionX(component, 0) - designer.getArea().getHorizontalValue(); int minX1 = button1.getX() + getParentPositionX(component, 0) - designer.getArea().getHorizontalValue();
int minY1 = button1.getY() + getParentPositionY(component, 0) - designer.getArea().getVerticalValue(); int minY1 = button1.getY() + getParentPositionY(component, 0) - designer.getArea().getVerticalValue();
if (e.getX() + GAP - xElementCase.getInsets().left > minX1 && e.getX() - GAP - xElementCase.getInsets().left < minX1 + button1.getWidth()) { if (e.getX() + GAP - component.getInsets().left > minX1 && e.getX() - GAP - component.getInsets().left < minX1 + button1.getWidth()) {
if (e.getY() + GAP - xElementCase.getInsets().top > minY1 && e.getY() - GAP - xElementCase.getInsets().top < minY1 + button1.getHeight()) { if (e.getY() + GAP - component.getInsets().top > minY1 && e.getY() - GAP - component.getInsets().top < minY1 + button1.getHeight()) {
designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
component.setHelpBtnOnFocus(true);
}
}
}
component.displayCoverPane(true);
component.setDirections(Direction.TOP_BOTTOM_LEFT_RIGHT);
} else {
//没有帮助信息时,不显示帮助图标
if (StringUtils.isEmpty(component.toData().getDescription())) {
return;
}
int minX1 = getParentPositionX(component, component.getX()) + component.getWidth() - ShareConstants.SHARE_EL_CONTROL_BUTTON_HW - designer.getArea().getHorizontalValue();
int minY1 = getParentPositionY(component, component.getY()) - designer.getArea().getVerticalValue();
if (e.getX() + GAP - component.getInsets().left > minX1 && e.getX() - GAP - component.getInsets().left < minX1 + ShareConstants.SHARE_EL_CONTROL_BUTTON_HW) {
if (e.getY() + GAP - component.getInsets().top > minY1 && e.getY() - GAP - component.getInsets().top < minY1 + ShareConstants.SHARE_EL_CONTROL_BUTTON_HW) {
designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
xElementCase.setHelpBtnOnFocus(true); component.setHelpBtnOnFocus(true);
} }
} }
} }
xElementCase.displayCoverPane(true);
xElementCase.setDirections(Direction.TOP_BOTTOM_LEFT_RIGHT);
} }
private void setCoverPaneNotDisplay(MouseEvent e, boolean isLinkedHelpDialog) { private void setCoverPaneNotDisplay(XCreator component, MouseEvent e, boolean isLinkedHelpDialog) {
if (xElementCase != null) { if (xElementCase != null) {
int x = getParentPositionX(xElementCase, 0) - designer.getArea().getHorizontalValue(); int x = getParentPositionX(xElementCase, 0) - designer.getArea().getHorizontalValue();
int y = getParentPositionY(xElementCase, 0) - designer.getArea().getVerticalValue(); int y = getParentPositionY(xElementCase, 0) - designer.getArea().getVerticalValue();
@ -337,15 +358,16 @@ public class EditingMouseListener extends MouseInputAdapter {
if (rect.contains(e.getPoint())) { if (rect.contains(e.getPoint())) {
return; return;
} }
if (isLinkedHelpDialog) {
xElementCase.destroyHelpDialog();
}
xElementCase.displayCoverPane(false); xElementCase.displayCoverPane(false);
} }
if (xChartEditor != null) { if (xChartEditor != null) {
xChartEditor.displayCoverPane(false); xChartEditor.displayCoverPane(false);
} }
if (isLinkedHelpDialog) {
component.destroyHelpDialog();
}
component.displayCoverPane(false);
if (xTopLayoutContainer != null) { if (xTopLayoutContainer != null) {
xTopLayoutContainer.setMouseEnter(false); xTopLayoutContainer.setMouseEnter(false);
} }
@ -371,6 +393,7 @@ public class EditingMouseListener extends MouseInputAdapter {
designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
} }
} }
setHelpBtnFocus(e, xTopLayoutContainer);
return true; return true;
} }
} }
@ -391,8 +414,7 @@ public class EditingMouseListener extends MouseInputAdapter {
designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
} }
} }
xChartEditor.displayCoverPane(true); setHelpBtnFocus(e, xChartEditor);
xChartEditor.setDirections(Direction.TOP_BOTTOM_LEFT_RIGHT);
designer.repaint(); designer.repaint();
} }
} }
@ -562,9 +584,6 @@ public class EditingMouseListener extends MouseInputAdapter {
if (designer.getCursor().getType() != Cursor.DEFAULT_CURSOR) { if (designer.getCursor().getType() != Cursor.DEFAULT_CURSOR) {
designer.setCursor(Cursor.getDefaultCursor()); designer.setCursor(Cursor.getDefaultCursor());
} }
setCoverPaneNotDisplay(e, true);
cancelPromptWidgetForbidEnter(); cancelPromptWidgetForbidEnter();
} }

14
designer_form/src/com/fr/design/mainframe/FormCreatorDropTarget.java

@ -13,10 +13,9 @@ import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.icon.IconPathConstants; import com.fr.design.icon.IconPathConstants;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.form.share.SharableEditorProvider;
import com.fr.form.share.ShareLoader; import com.fr.form.share.ShareLoader;
import com.fr.form.ui.ElCaseBindInfo; import com.fr.form.ui.SharableWidgetBindInfo;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.ui.SharableElementCaseEditor;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.Constants; import com.fr.stable.Constants;
@ -84,14 +83,15 @@ public class FormCreatorDropTarget extends DropTarget {
Widget widget = (addingXCreator.getTopLayout() != null) ? (addingXCreator.getTopLayout().toData()) : addingXCreator.toData(); Widget widget = (addingXCreator.getTopLayout() != null) ? (addingXCreator.getTopLayout().toData()) : addingXCreator.toData();
if (addingXCreator.isShared()) { if (addingXCreator.isShared()) {
String shareId = addingXCreator.getShareId(); String shareId = addingXCreator.getShareId();
SharableElementCaseEditor sharableEditor = ShareLoader.getLoader().getSharedElCaseEditorById(shareId); SharableEditorProvider sharableEditor = ShareLoader.getLoader().getSharedElCaseEditorById(shareId);
ElCaseBindInfo bindInfo = ShareLoader.getLoader().getElCaseBindInfoById(shareId); SharableWidgetBindInfo bindInfo = ShareLoader.getLoader().getElCaseBindInfoById(shareId);
if (sharableEditor != null && bindInfo != null) { if (sharableEditor != null && bindInfo != null) {
Map<String, String> tdNameMap = TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).addTableData(bindInfo.getName(), sharableEditor.getTableDataSource()); Map<String, String> tdNameMap = TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).addTableData(bindInfo.getName(), sharableEditor.getTableDataSource());
//合并数据集之后,可能会有数据集名称变化,做一下联动 //合并数据集之后,可能会有数据集名称变化,做一下联动
//共享的组件拿的时候都是克隆的,这边改拖拽中克隆的对象而非新克隆对象,上面这个新克隆的对象只是为了拿数据集 //共享的组件拿的时候都是克隆的,这边改拖拽中克隆的对象而非新克隆对象,上面这个新克隆的对象只是为了拿数据集
ElementCaseEditor elementCaseEditor = (ElementCaseEditor) widget; for (Map.Entry<String, String> entry : tdNameMap.entrySet()) {
elementCaseEditor.batchRenameTdName(tdNameMap); designer.getTarget().renameTableData(widget, entry.getKey(), entry.getValue());
}
} }
} }
designer.getSelectionModel().setSelectedCreators( designer.getSelectionModel().setSelectedCreators(

1
designer_form/src/com/fr/design/mainframe/FormDesigner.java

@ -475,7 +475,6 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
paraHeight = 0; paraHeight = 0;
paraComponent = null; paraComponent = null;
formLayoutContainer.setSize(rootComponent.getWidth(), rootComponent.getHeight()); formLayoutContainer.setSize(rootComponent.getWidth(), rootComponent.getHeight());
EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(this.getEastDownPane());
//atat //atat
//EastRegionContainerPane.getInstance().addTitlePane(ParameterPropertyPane.getInstance(FormDesigner.this)); //EastRegionContainerPane.getInstance().addTitlePane(ParameterPropertyPane.getInstance(FormDesigner.this));
//删除后重绘下 //删除后重绘下

21
designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java

@ -3,13 +3,12 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.share.ShareLoader; import com.fr.form.share.ShareLoader;
import com.fr.form.ui.ElCaseBindInfo; import com.fr.form.ui.SharableWidgetBindInfo;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
@ -41,7 +40,7 @@ public class FormWidgetDetailPane extends FormDockView{
private UIScrollPane downPane; private UIScrollPane downPane;
private JPanel reuWidgetPanel; private JPanel reuWidgetPanel;
private UIComboBox comboBox; private UIComboBox comboBox;
private ElCaseBindInfo[] elCaseBindInfoList; private SharableWidgetBindInfo[] elCaseBindInfoList;
private UIButton deleteButton; private UIButton deleteButton;
private UIButton resetButton; private UIButton resetButton;
private JPanel editPanel; private JPanel editPanel;
@ -118,21 +117,7 @@ public class FormWidgetDetailPane extends FormDockView{
initReuWidgetPanel(); initReuWidgetPanel();
initMenuPanel(); initMenuPanel();
card = new CardLayout(); add(reuWidgetPanel, BorderLayout.CENTER);
tabbedPane = new JPanel();
tabbedPane.setLayout(card);
tabbedPane.add(REPORT_TAB, reuWidgetPanel);
tabbedPane.add(CHART_TAB, new JPanel());
UIHeadGroup tabsHeaderIconPane = new UIHeadGroup(new String[] {REPORT_TAB, CHART_TAB}) {
@Override
public void tabChanged(int index) {
card.show(tabbedPane, labelButtonList.get(index).getText());
}
};
tabsHeaderIconPane.setNeedLeftRightOutLine(false);
add(tabsHeaderIconPane, BorderLayout.NORTH);
add(tabbedPane, BorderLayout.CENTER);
} }

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

@ -576,6 +576,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
this.reportComposite.setSelectedWidget(dataTable); this.reportComposite.setSelectedWidget(dataTable);
//下面这句话是防止撤销之后直接退出编辑再编辑撤销的东西会回来,因为撤销不会保存EC //下面这句话是防止撤销之后直接退出编辑再编辑撤销的东西会回来,因为撤销不会保存EC
formDesign.setElementCase(dataTable); formDesign.setElementCase(dataTable);
elementCaseDesign.refreshPropertyPane();
} }
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
throw new RuntimeException(e); throw new RuntimeException(e);

18
designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java

@ -4,9 +4,11 @@ import com.fr.base.vcs.DesignerMode;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.base.iofileattr.SharableAttrMark;
import com.fr.form.ui.AbstractBorderStyleWidget;
import com.fr.share.ShareConstants; import com.fr.share.ShareConstants;
import com.fr.form.share.ShareLoader; import com.fr.form.share.ShareLoader;
import com.fr.form.ui.ElCaseBindInfo; import com.fr.form.ui.SharableWidgetBindInfo;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
@ -31,7 +33,7 @@ import java.io.Serializable;
* Time: 16:14 * Time: 16:14
*/ */
public class ShareWidgetButton extends JPanel implements MouseListener, MouseMotionListener, Serializable { public class ShareWidgetButton extends JPanel implements MouseListener, MouseMotionListener, Serializable {
private ElCaseBindInfo bindInfo; private SharableWidgetBindInfo bindInfo;
private MouseEvent lastPressEvent; private MouseEvent lastPressEvent;
private JPanel reportPane; private JPanel reportPane;
private boolean isEdit; private boolean isEdit;
@ -50,7 +52,7 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot
} }
}; };
public ShareWidgetButton(ElCaseBindInfo bindInfo) { public ShareWidgetButton(SharableWidgetBindInfo bindInfo) {
this.bindInfo = bindInfo; this.bindInfo = bindInfo;
this.setPreferredSize(new Dimension(108, 68)); this.setPreferredSize(new Dimension(108, 68));
initUI(); initUI();
@ -127,11 +129,11 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot
}; };
} }
public ElCaseBindInfo getBindInfo() { public SharableWidgetBindInfo getBindInfo() {
return bindInfo; return bindInfo;
} }
public void setBindInfo(ElCaseBindInfo bindInfo) { public void setBindInfo(SharableWidgetBindInfo bindInfo) {
this.bindInfo = bindInfo; this.bindInfo = bindInfo;
} }
@ -194,15 +196,17 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot
} }
shareId = no.getBindInfo().getId(); shareId = no.getBindInfo().getId();
creatorSource = ShareLoader.getLoader().getElCaseEditorById(shareId); creatorSource = ShareLoader.getLoader().getElCaseEditorById(shareId);
}
if (creatorSource != null) { if (creatorSource != null) {
XCreator xCreator = XCreatorUtils.createXCreator(creatorSource); ((AbstractBorderStyleWidget)creatorSource).addWidgetAttrMark(new SharableAttrMark(true));
XCreator xCreator = XCreatorUtils.createXCreator(creatorSource, new Dimension(no.getBindInfo().getWidth(), no.getBindInfo().getHeight()));
xCreator.setBackupBound(xCreator.getBounds());
xCreator.setShareId(shareId); xCreator.setShareId(shareId);
WidgetToolBarPane.getTarget().startDraggingBean(xCreator); WidgetToolBarPane.getTarget().startDraggingBean(xCreator);
lastPressEvent = null; lastPressEvent = null;
this.setBorder(null); this.setBorder(null);
} }
} }
}
@Override @Override
public void mouseMoved(MouseEvent e) { public void mouseMoved(MouseEvent e) {

6
designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java

@ -1,7 +1,7 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.form.ui.ElCaseBindInfo; import com.fr.form.ui.SharableWidgetBindInfo;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -12,12 +12,12 @@ import java.awt.*;
*/ */
public class ShareWidgetPane extends JPanel { public class ShareWidgetPane extends JPanel {
public ShareWidgetPane(ElCaseBindInfo[] elCaseBindInfoList, boolean isEdit) { public ShareWidgetPane(SharableWidgetBindInfo[] elCaseBindInfoList, boolean isEdit) {
this.setBorder(BorderFactory.createEmptyBorder(10, 3, 0, 0));// 设置面板的边框 ,距离上、左、下、右 的距离 this.setBorder(BorderFactory.createEmptyBorder(10, 3, 0, 0));// 设置面板的边框 ,距离上、左、下、右 的距离
if (elCaseBindInfoList != null) { if (elCaseBindInfoList != null) {
int rowCount = (elCaseBindInfoList.length + 1) / 2; int rowCount = (elCaseBindInfoList.length + 1) / 2;
this.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 10)); this.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 10));
for (ElCaseBindInfo rbModuleInfo : elCaseBindInfoList) { for (SharableWidgetBindInfo rbModuleInfo : elCaseBindInfoList) {
ShareWidgetButton widgetButton = new ShareWidgetButton(rbModuleInfo); ShareWidgetButton widgetButton = new ShareWidgetButton(rbModuleInfo);
widgetButton.setElementCaseEdit(isEdit); widgetButton.setElementCaseEdit(isEdit);
this.add(widgetButton); this.add(widgetButton);

18
designer_form/src/com/fr/design/mainframe/ElementCaseHelpDialog.java → designer_form/src/com/fr/design/mainframe/WidgetHelpDialog.java

@ -5,6 +5,7 @@ import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.gui.itextarea.UITextArea;
import com.fr.general.Inter; import com.fr.general.Inter;
import java.awt.event.MouseEvent;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -13,17 +14,19 @@ import java.awt.*;
* @date 2016-10-14 * @date 2016-10-14
* @since 8.0 * @since 8.0
*/ */
public class ElementCaseHelpDialog extends UIDialog { public class WidgetHelpDialog extends UIDialog {
private static final int OUTER_WIDTH = 190; private static final int OUTER_WIDTH = 190;
private static final int OUTER_HEIGHT = 280; private static final int OUTER_HEIGHT = 280;
private static final int DIALOG_X = 227;
private static final int DIALOG_Y = 165;
private String helpMsg; private String helpMsg;
private UIScrollPane helpArea; private UIScrollPane helpArea;
public ElementCaseHelpDialog(Frame parent, String helpMsg) { public WidgetHelpDialog(Frame parent, String helpMsg) {
super(parent); super(parent);
this.helpMsg = helpMsg; this.helpMsg = helpMsg;
initHelpArea(); initHelpArea();
@ -56,6 +59,17 @@ public class ElementCaseHelpDialog extends UIDialog {
setVisible(true); setVisible(true);
} }
/**
* 打开帮助框-e
*/
public void showWindow(MouseEvent e) {
int rX = WestRegionContainerPane.getInstance().getWidth() + e.getX() - DIALOG_X;//弹出框宽度190加上图标的宽度27加上10的偏移
int rY = DIALOG_Y + e.getY();//165是设计器最上面几个面板的高度
this.setLocationRelativeTo(DesignerContext.getDesignerFrame(), rX, rY);
this.setResizable(false);
setVisible(true);
}
/** /**
* *
*/ */

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

@ -4,18 +4,68 @@ import com.fr.base.FRContext;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.gui.core.WidgetConstants; import com.fr.design.gui.core.WidgetConstants;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.widget.ui.designer.WidgetDefinePane;
import com.fr.design.parameter.RootDesignDefinePane; import com.fr.design.parameter.RootDesignDefinePane;
import com.fr.design.widget.ui.designer.*; import com.fr.design.widget.ui.designer.CheckBoxDefinePane;
import com.fr.design.widget.ui.designer.layout.*; import com.fr.design.widget.ui.designer.CheckBoxGroupDefinePane;
import com.fr.design.widget.ui.designer.ComboBoxDefinePane;
import com.fr.design.widget.ui.designer.ComboCheckBoxDefinePane;
import com.fr.design.widget.ui.designer.DateEditorDefinePane;
import com.fr.design.widget.ui.designer.FreeButtonDefinePane;
import com.fr.design.widget.ui.designer.IframeEditorDefinePane;
import com.fr.design.widget.ui.designer.LabelDefinePane;
import com.fr.design.widget.ui.designer.MultiFileEditorPane;
import com.fr.design.widget.ui.designer.NoneWidgetDefinePane;
import com.fr.design.widget.ui.designer.NumberEditorDefinePane;
import com.fr.design.widget.ui.designer.PasswordDefinePane;
import com.fr.design.widget.ui.designer.RadioDefinePane;
import com.fr.design.widget.ui.designer.RadioGroupDefinePane;
import com.fr.design.widget.ui.designer.TextAreaDefinePane;
import com.fr.design.widget.ui.designer.TextFieldEditorDefinePane;
import com.fr.design.widget.ui.designer.TreeComboBoxEditorDefinePane;
import com.fr.design.widget.ui.designer.TreeEditorDefinePane;
import com.fr.design.widget.ui.designer.UserEditorDefinePane;
import com.fr.design.widget.ui.designer.WidgetDefinePane;
import com.fr.design.widget.ui.designer.layout.BorderStyleWidgetDefinePane;
import com.fr.design.widget.ui.designer.layout.ElementEditorDefinePane;
import com.fr.design.widget.ui.designer.layout.FRAbsoluteBodyLayoutDefinePane;
import com.fr.design.widget.ui.designer.layout.FRAbsoluteLayoutDefinePane;
import com.fr.design.widget.ui.designer.layout.FRFitLayoutDefinePane;
import com.fr.design.widget.ui.designer.layout.WCardLayoutDefinePane;
import com.fr.design.widget.ui.designer.layout.WCardMainLayoutDefinePane;
import com.fr.design.widget.ui.designer.layout.WCardTagLayoutDefinePane;
import com.fr.design.widget.ui.designer.layout.WTabFitLayoutDefinePane;
import com.fr.form.parameter.FormSubmitButton; import com.fr.form.parameter.FormSubmitButton;
import com.fr.form.ui.*; import com.fr.form.ui.Button;
import com.fr.form.ui.container.*; import com.fr.form.ui.ChartEditor;
import com.fr.form.ui.CheckBox;
import com.fr.form.ui.CheckBoxGroup;
import com.fr.form.ui.ComboBox;
import com.fr.form.ui.ComboCheckBox;
import com.fr.form.ui.DateEditor;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.ui.FreeButton;
import com.fr.form.ui.IframeEditor;
import com.fr.form.ui.Label;
import com.fr.form.ui.MultiFileEditor;
import com.fr.form.ui.NameWidget;
import com.fr.form.ui.NoneWidget;
import com.fr.form.ui.NumberEditor;
import com.fr.form.ui.Password;
import com.fr.form.ui.Radio;
import com.fr.form.ui.RadioGroup;
import com.fr.form.ui.TextArea;
import com.fr.form.ui.TextEditor;
import com.fr.form.ui.TreeComboBoxEditor;
import com.fr.form.ui.TreeEditor;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WAbsoluteBodyLayout;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WCardLayout;
import com.fr.form.ui.container.WFitLayout;
import com.fr.form.ui.container.WParameterLayout;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.form.ui.container.cardlayout.WTabFitLayout; import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.stable.bridge.BridgeMark;
import com.fr.stable.bridge.StableFactory;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.util.HashMap; import java.util.HashMap;
@ -56,10 +106,7 @@ public class FormWidgetDefinePaneFactoryBase {
defineMap.put(FormSubmitButton.class, new Appearance(FreeButtonDefinePane.class, WidgetConstants.BUTTON + "")); defineMap.put(FormSubmitButton.class, new Appearance(FreeButtonDefinePane.class, WidgetConstants.BUTTON + ""));
defineMap.put(WFitLayout.class, new Appearance(FRFitLayoutDefinePane.class, "wFitLayout")); defineMap.put(WFitLayout.class, new Appearance(FRFitLayoutDefinePane.class, "wFitLayout"));
defineMap.put(WCardMainBorderLayout.class, new Appearance(WCardMainLayoutDefinePane.class, "wCardMainBorderLayout")); defineMap.put(WCardMainBorderLayout.class, new Appearance(WCardMainLayoutDefinePane.class, "wCardMainBorderLayout"));
if (StableFactory.getMarkedClass(BridgeMark.CHART_EDITOR, AbstractBorderStyleWidget.class) != null) { defineMap.put(ChartEditor.class, new Appearance(BorderStyleWidgetDefinePane.class, "chartEditor"));
defineMap.put(StableFactory.getMarkedClass(BridgeMark.CHART_EDITOR, AbstractBorderStyleWidget.class), new Appearance(BorderStyleWidgetDefinePane.class, "chartEditor"));
}
defineMap.put(WAbsoluteLayout.class, new Appearance(FRAbsoluteLayoutDefinePane.class, "wAbsoluteLayout")); defineMap.put(WAbsoluteLayout.class, new Appearance(FRAbsoluteLayoutDefinePane.class, "wAbsoluteLayout"));
defineMap.put(ElementCaseEditor.class, new Appearance(ElementEditorDefinePane.class, "elementCaseEditor")); defineMap.put(ElementCaseEditor.class, new Appearance(ElementEditorDefinePane.class, "elementCaseEditor"));
defineMap.put(WAbsoluteBodyLayout.class, new Appearance(FRAbsoluteBodyLayoutDefinePane.class, "wAbsoluteBodyLayout")); defineMap.put(WAbsoluteBodyLayout.class, new Appearance(FRAbsoluteBodyLayoutDefinePane.class, "wAbsoluteBodyLayout"));

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

@ -1,5 +1,6 @@
package com.fr.design.widget.ui.designer.component; package com.fr.design.widget.ui.designer.component;
import com.fr.base.iofileattr.TemplateIdAttrMark;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -7,8 +8,8 @@ import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.AbstractMarginWidget;
import com.fr.form.ui.PaddingMargin; import com.fr.form.ui.PaddingMargin;
import com.fr.form.ui.RichStyleWidgetProvider;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -75,7 +76,7 @@ public class PaddingBoundPane extends BasicPane{
} }
public void update(AbstractMarginWidget marginWidget) { public void update(RichStyleWidgetProvider 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() ));
} }
@ -83,7 +84,7 @@ public class PaddingBoundPane extends BasicPane{
return "PaddingBoundPane"; return "PaddingBoundPane";
} }
public void populate(AbstractMarginWidget marginWidget) { public void populate(RichStyleWidgetProvider marginWidget) {
PaddingMargin paddingMargin = marginWidget.getMargin(); PaddingMargin paddingMargin = marginWidget.getMargin();
top.setValue(paddingMargin.getTop()); top.setValue(paddingMargin.getTop());
bottom.setValue(paddingMargin.getBottom()); bottom.setValue(paddingMargin.getBottom());

Loading…
Cancel
Save