Browse Source

Merge pull request #85 in DESIGN/design from ~PLOUGH/10-design:feature/10.0 to feature/10.0

* commit 'f1dc915f1cf75b9914f8fac2969cce1f07fc0d24':
  REPORT-8355 9.0之前开发的功能与bug patch到10.0(部分)
  REPORT-6645 参数面板里的bug2
  REPORT-6558 & REPORT-6443 & REPORT-6645 组件叠加优化交互验收;控件树消失问题=>减少对其他地方的影响;参数面板里的bug2
  REPORT-6626 绝对布局下组件复制粘贴后属性设置有问题
  REPORT-6392 决策报表组件重名时数据错乱
  REPORT-6245 设计器,悬浮元素,修改悬浮元素名称,点击确定,日志抛错
  REPORT-6190 9.0设计器设置了几个超链,编辑几个属性后,设计器整个卡掉了
  REPORT-5908 && REPORT-6110 设计器下拉菜单、右击菜单视觉调整缩放弹窗也改成圆角样式;设计器模板内存智能优化优化了一下模板激活时间,去掉激活时刷新右侧面板调用
master
superman 7 years ago
parent
commit
3e320dc79c
  1. 24
      designer-base/src/com/fr/design/DesignerEnvManager.java
  2. 9
      designer-base/src/com/fr/design/actions/UpdateAction.java
  3. 22
      designer-base/src/com/fr/design/actions/file/PreferencePane.java
  4. 1
      designer-base/src/com/fr/design/constants/UIConstants.java
  5. 13
      designer-base/src/com/fr/design/event/DesignerOpenedListener.java
  6. 2
      designer-base/src/com/fr/design/file/HistoryTemplateListPane.java
  7. 3
      designer-base/src/com/fr/design/file/MutilTempalteTabPane.java
  8. 5
      designer-base/src/com/fr/design/gui/controlpane/UIListControlPane.java
  9. 11
      designer-base/src/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java
  10. 82
      designer-base/src/com/fr/design/gui/ibutton/UIRadioButton.java
  11. 4
      designer-base/src/com/fr/design/gui/icheckbox/UICheckBox.java
  12. 31
      designer-base/src/com/fr/design/layout/FRGUIPaneFactory.java
  13. 15
      designer-base/src/com/fr/design/layout/VerticalFlowLayout.java
  14. 21
      designer-base/src/com/fr/design/mainframe/DesignerFrame.java
  15. 16
      designer-base/src/com/fr/design/mainframe/EastRegionContainerPane.java
  16. 27
      designer-base/src/com/fr/design/mainframe/JSliderPane.java
  17. 28
      designer-base/src/com/fr/design/mainframe/JTemplate.java
  18. 4
      designer-base/src/com/fr/design/mainframe/JVirtualTemplate.java
  19. 2
      designer-base/src/com/fr/design/mainframe/backgroundpane/ImageBackgroundQuickPane.java
  20. 30
      designer-base/src/com/fr/design/mainframe/widget/BasicPropertyPane.java
  21. 47
      designer-base/src/com/fr/design/utils/gui/GUICoreUtils.java
  22. 1
      designer-base/src/com/fr/start/BaseDesigner.java
  23. 3
      designer-form/src/com/fr/design/designer/beans/actions/CopyAction.java
  24. 3
      designer-form/src/com/fr/design/designer/beans/actions/CutAction.java
  25. 8
      designer-form/src/com/fr/design/designer/beans/actions/FormDeleteAction.java
  26. 17
      designer-form/src/com/fr/design/designer/beans/actions/FormWidgetEditAction.java
  27. 12
      designer-form/src/com/fr/design/designer/beans/actions/MoveDownAction.java
  28. 21
      designer-form/src/com/fr/design/designer/beans/actions/MoveToBottomAction.java
  29. 21
      designer-form/src/com/fr/design/designer/beans/actions/MoveToTopAction.java
  30. 14
      designer-form/src/com/fr/design/designer/beans/actions/MoveUpAction.java
  31. 20
      designer-form/src/com/fr/design/designer/beans/actions/behavior/ComponentEnable.java
  32. 19
      designer-form/src/com/fr/design/designer/beans/actions/behavior/MovableDownEnable.java
  33. 19
      designer-form/src/com/fr/design/designer/beans/actions/behavior/MovableUpEnable.java
  34. 8
      designer-form/src/com/fr/design/designer/beans/actions/behavior/UpdateBehavior.java
  35. 48
      designer-form/src/com/fr/design/designer/creator/XCreator.java
  36. 2
      designer-form/src/com/fr/design/designer/creator/XCreatorTools.java
  37. 33
      designer-form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java
  38. 25
      designer-form/src/com/fr/design/designer/creator/XWFitLayout.java
  39. 5
      designer-form/src/com/fr/design/designer/creator/XWParameterLayout.java
  40. 2
      designer-form/src/com/fr/design/designer/properties/EventPropertyTable.java
  41. BIN
      designer-form/src/com/fr/design/form/images/joption_failure.png
  42. BIN
      designer-form/src/com/fr/design/form/images/joption_success.png
  43. 7
      designer-form/src/com/fr/design/form/parameter/FormParaDesigner.java
  44. 5
      designer-form/src/com/fr/design/mainframe/ComponentTree.java
  45. 22
      designer-form/src/com/fr/design/mainframe/FormCreatorDropTarget.java
  46. 50
      designer-form/src/com/fr/design/mainframe/FormDesigner.java
  47. 12
      designer-form/src/com/fr/design/mainframe/JForm.java
  48. 93
      designer-form/src/com/fr/design/mainframe/WidgetHelpDialog.java
  49. 71
      designer-form/src/com/fr/design/mainframe/WidgetPropertyPane.java
  50. 25
      designer-form/src/com/fr/design/mainframe/actions/FormMobileAttrAction.java
  51. 10
      designer-form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java
  52. 16
      designer-form/src/com/fr/design/parameter/ParameterPropertyPane.java
  53. 49
      designer-form/src/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java
  54. 12
      designer-form/src/com/fr/design/widget/ui/designer/mobile/MobileWidgetDefinePane.java
  55. 2
      designer-realize/src/com/fr/design/actions/edit/EditFloatElementNameAction.java
  56. 75
      designer-realize/src/com/fr/design/actions/report/ReportPrintSettingAction.java
  57. 2
      designer-realize/src/com/fr/design/mainframe/ElementCasePaneDelegate.java
  58. 7
      designer-realize/src/com/fr/design/mainframe/JWorkBook.java
  59. 132
      designer-realize/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java
  60. 7
      designer-realize/src/com/fr/design/mainframe/form/FormElementCasePaneDelegate.java
  61. 4
      designer-realize/src/com/fr/design/report/PageSetupPane.java
  62. 15
      designer-realize/src/com/fr/design/webattr/EditReportServerParameterPane.java
  63. 71
      designer-realize/src/com/fr/design/webattr/ReportWebWidgetConstants.java
  64. 2
      designer-realize/src/com/fr/design/webattr/ToolBarDragPane.java
  65. 365
      designer-realize/src/com/fr/design/webattr/printsettings/NativePrintSettingPane.java
  66. 103
      designer-realize/src/com/fr/design/webattr/printsettings/NoClientPrintSettingPane.java
  67. 79
      designer-realize/src/com/fr/design/webattr/printsettings/PageMarginSettingPane.java
  68. 112
      designer-realize/src/com/fr/design/webattr/printsettings/PrintSettingPane.java
  69. 101
      designer-realize/src/com/fr/design/webattr/printsettings/ReportPrintSettingPane.java
  70. 2
      designer-realize/src/com/fr/design/widget/WidgetEventPane.java
  71. 36
      designer-realize/src/com/fr/grid/Grid.java
  72. 15
      designer-realize/src/com/fr/grid/GridUI.java

24
designer-base/src/com/fr/design/DesignerEnvManager.java

@ -61,6 +61,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private static final int MAX_SHOW_NUM = 10; private static final int MAX_SHOW_NUM = 10;
private static final String VERSION_80 = "80"; private static final String VERSION_80 = "80";
private static final int CACHINGTEMPLATE_LIMIT = 5;
private static DesignerEnvManager designerEnvManager; // gui. private static DesignerEnvManager designerEnvManager; // gui.
private String activationKey = null; private String activationKey = null;
@ -99,6 +100,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private int language; private int language;
//2014-8-26默认显示全部, 因为以前的版本, 虽然是false, 实际上是显示所有表, 因此这边要兼容 //2014-8-26默认显示全部, 因为以前的版本, 虽然是false, 实际上是显示所有表, 因此这边要兼容
private boolean useOracleSystemSpace = true; private boolean useOracleSystemSpace = true;
private int cachingTemplateLimit = CACHINGTEMPLATE_LIMIT;
private boolean autoBackUp = true; private boolean autoBackUp = true;
private int undoLimit = 5; private int undoLimit = 5;
private short pageLengthUnit = Constants.UNIT_MM; private short pageLengthUnit = Constants.UNIT_MM;
@ -244,7 +246,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
// 写文件的LogLocation // 写文件的LogLocation
String logLocation = DesignerEnvManager.getEnvManager().getLogLocation(); String logLocation = DesignerEnvManager.getEnvManager().getLogLocation();
if (logLocation != null) { //Mac下8.0,9.0 选项-日志设置为空时在根目录下检测文件存在会抛无权限,这里应该设个默认值比较好吧
if (StringUtils.isNotEmpty(logLocation)) {
try { try {
Calendar calender = GregorianCalendar.getInstance(); Calendar calender = GregorianCalendar.getInstance();
calender.setTimeInMillis(System.currentTimeMillis()); calender.setTimeInMillis(System.currentTimeMillis());
@ -629,6 +632,21 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.useOracleSystemSpace = displayOracleSystem; this.useOracleSystemSpace = displayOracleSystem;
} }
/**
* 配置最大缓存模板个数
*/
public void setCachingTemplateLimit(int cachingTemplateLimit) {
this.cachingTemplateLimit = cachingTemplateLimit;
}
/**
* 获取最大缓存模板个数
*/
public int getCachingTemplateLimit() {
return this.cachingTemplateLimit;
}
/** /**
* 是否加入产品改良 * 是否加入产品改良
* *
@ -1392,6 +1410,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.setMaxNumberOrPreviewRow(reader.getAttrAsInt("maxNumberOrPreviewRow", 200)); this.setMaxNumberOrPreviewRow(reader.getAttrAsInt("maxNumberOrPreviewRow", 200));
this.setOracleSystemSpace(reader.getAttrAsBoolean("useOracleSystemSpace", true)); this.setOracleSystemSpace(reader.getAttrAsBoolean("useOracleSystemSpace", true));
this.setCachingTemplateLimit(reader.getAttrAsInt("cachingTemplateLimit", CACHINGTEMPLATE_LIMIT));
this.setJoinProductImprove(reader.getAttrAsBoolean("joinProductImprove", true)); this.setJoinProductImprove(reader.getAttrAsBoolean("joinProductImprove", 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));
@ -1612,6 +1631,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if (!this.isOracleSystemSpace()) { if (!this.isOracleSystemSpace()) {
writer.attr("useOracleSystemSpace", this.isOracleSystemSpace()); writer.attr("useOracleSystemSpace", this.isOracleSystemSpace());
} }
if (this.getCachingTemplateLimit() >= 0) {
writer.attr("cachingTemplateLimit", this.getCachingTemplateLimit());
}
if (!this.isJoinProductImprove()) { if (!this.isJoinProductImprove()) {
writer.attr("joinProductImprove", this.isJoinProductImprove()); writer.attr("joinProductImprove", this.isJoinProductImprove());
} }

9
designer-base/src/com/fr/design/actions/UpdateAction.java

@ -293,13 +293,20 @@ public abstract class UpdateAction extends ShortCut implements Action {
button.setEnabled(this.isEnabled()); button.setEnabled(this.isEnabled());
//peter:产生tooltip //peter:产生tooltip
button.setToolTipText(ActionFactory.createButtonToolTipText(this)); button.setToolTipText(getToolTipText());
object = button; object = button;
} }
return (JComponent) object; return (JComponent) object;
} }
/**
* 重写此方法可以自定义 action 的提示文字
*/
protected String getToolTipText() {
return ActionFactory.createButtonToolTipText(this);
}
/** /**
* Equals * Equals
*/ */

22
designer-base/src/com/fr/design/actions/file/PreferencePane.java

@ -14,6 +14,7 @@ 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.ActionLabel; import com.fr.design.gui.ilable.ActionLabel;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.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.layout.TableLayout; import com.fr.design.layout.TableLayout;
@ -55,6 +56,9 @@ public class PreferencePane extends BasicPane {
private static final int MAX_UNDO_LIMIT_50 = 50; private static final int MAX_UNDO_LIMIT_50 = 50;
private static final int SELECTED_INDEX_4 = 4; private static final int SELECTED_INDEX_4 = 4;
private static final int SELECTED_INDEX_5 = 5; private static final int SELECTED_INDEX_5 = 5;
private static final int CACHING_MAX = 10;
private static final int CACHING_DEFAULT = 5;
private static final int CACHING_GAP = 5;
private static final String TYPE = "pressed"; private static final String TYPE = "pressed";
private static final String DISPLAY_TYPE = "+"; private static final String DISPLAY_TYPE = "+";
@ -113,6 +117,7 @@ public class PreferencePane extends BasicPane {
private IntegerEditor portEditor; private IntegerEditor portEditor;
private UITextField jdkHomeTextField; private UITextField jdkHomeTextField;
private UICheckBox oracleSpace; private UICheckBox oracleSpace;
private UISpinner cachingTemplateSpinner;
private UICheckBox joinProductImprove; private UICheckBox joinProductImprove;
public PreferencePane() { public PreferencePane() {
@ -173,6 +178,7 @@ public class PreferencePane extends BasicPane {
JPanel spaceUpPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel spaceUpPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
spaceUpPane.add(oraclePane, BorderLayout.NORTH); spaceUpPane.add(oraclePane, BorderLayout.NORTH);
spaceUpPane.add(createMemoryPane(), BorderLayout.CENTER);
spaceUpPane.add(improvePane, BorderLayout.SOUTH); spaceUpPane.add(improvePane, BorderLayout.SOUTH);
advancePane.add(spaceUpPane); advancePane.add(spaceUpPane);
} }
@ -497,6 +503,20 @@ public class PreferencePane extends BasicPane {
serverPortPane.add(choosePortPane, BorderLayout.CENTER); serverPortPane.add(choosePortPane, BorderLayout.CENTER);
} }
private JPanel createMemoryPane() {
JPanel memoryPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Preference_CachingTemplate"));
UILabel memoryLabel = new UILabel(Inter.getLocText("FR-Designer_Preference_MaxCachingTemplate"));
UILabel memoryTipLabel = new UILabel(Inter.getLocText("FR-Designer_Preference_CachingTemplateTip"));
memoryTipLabel.setBorder(BorderFactory.createEmptyBorder( 0, CACHING_GAP, 0, 0));
cachingTemplateSpinner = new UISpinner(0, CACHING_MAX, 1, CACHING_DEFAULT);
JPanel memorySpace = new JPanel(FRGUIPaneFactory.createLeftZeroLayout());
memorySpace.add(memoryLabel);
memorySpace.add(cachingTemplateSpinner);
memorySpace.add(memoryTipLabel);
memoryPane.add(memorySpace);
return memoryPane;
}
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Inter.getLocText("M_Window-Preference"); return Inter.getLocText("M_Window-Preference");
@ -555,6 +575,7 @@ public class PreferencePane extends BasicPane {
this.jdkHomeTextField.setText(designerEnvManager.getJdkHome()); this.jdkHomeTextField.setText(designerEnvManager.getJdkHome());
this.oracleSpace.setSelected(designerEnvManager.isOracleSystemSpace()); this.oracleSpace.setSelected(designerEnvManager.isOracleSystemSpace());
this.cachingTemplateSpinner.setValue(designerEnvManager.getCachingTemplateLimit());
this.joinProductImprove.setSelected(designerEnvManager.isJoinProductImprove()); this.joinProductImprove.setSelected(designerEnvManager.isJoinProductImprove());
} }
@ -615,6 +636,7 @@ public class PreferencePane extends BasicPane {
designerEnvManager.setJdkHome(jdkHomeTextField.getText()); designerEnvManager.setJdkHome(jdkHomeTextField.getText());
designerEnvManager.setOracleSystemSpace(this.oracleSpace.isSelected()); designerEnvManager.setOracleSystemSpace(this.oracleSpace.isSelected());
designerEnvManager.setCachingTemplateLimit((int) this.cachingTemplateSpinner.getValue());
designerEnvManager.setJoinProductImprove(this.joinProductImprove.isSelected()); designerEnvManager.setJoinProductImprove(this.joinProductImprove.isSelected());
// designerEnvManager.setAutoBackUp(this.autoBackUp.isSelected()); // designerEnvManager.setAutoBackUp(this.autoBackUp.isSelected());

1
designer-base/src/com/fr/design/constants/UIConstants.java

@ -108,6 +108,7 @@ public interface UIConstants {
public static final Color AUTHORITY_SHEET_UNSELECTED = new Color(146, 192, 225); public static final Color AUTHORITY_SHEET_UNSELECTED = new Color(146, 192, 225);
public static final Color ATTRIBUTE_PRESS = new Color(0x419BF9); public static final Color ATTRIBUTE_PRESS = new Color(0x419BF9);
public static final Color NORMAL_BLUE = new Color(0x419BF9); public static final Color NORMAL_BLUE = new Color(0x419BF9);
public static final Color DISABLED_ICON_COLOR = new Color(170, 170, 171);
public static final Color ATTRIBUTE_NORMAL = Color.WHITE; public static final Color ATTRIBUTE_NORMAL = Color.WHITE;
public static final Color ATTRIBUTE_HOVER = new Color(0xF5F5F7); public static final Color ATTRIBUTE_HOVER = new Color(0xF5F5F7);
public static final Color UI_TOOLBAR_COLOR = new Color(0xF5F5F7); public static final Color UI_TOOLBAR_COLOR = new Color(0xF5F5F7);

13
designer-base/src/com/fr/design/event/DesignerOpenedListener.java

@ -0,0 +1,13 @@
package com.fr.design.event;
import java.util.EventListener;
/**
* Created by plough on 2018/1/19.
*/
public interface DesignerOpenedListener extends EventListener {
/**
* Invoked when the target of the listener has changed the rpt content.
*/
public void designerOpened();
}

2
designer-base/src/com/fr/design/file/HistoryTemplateListPane.java

@ -35,7 +35,7 @@ import java.util.List;
public class HistoryTemplateListPane extends JPanel implements FileOperations, CallbackEvent { public class HistoryTemplateListPane extends JPanel implements FileOperations, CallbackEvent {
//最大保存内存中面板数,为0时关闭优化内存 //最大保存内存中面板数,为0时关闭优化内存
private static final int DEAD_LINE = 5; private static final int DEAD_LINE = DesignerEnvManager.getEnvManager().getCachingTemplateLimit();;
private static final int LIST_BORDER = 4; private static final int LIST_BORDER = 4;
private List<JTemplate<?, ?>> historyList; private List<JTemplate<?, ?>> historyList;
private JTemplate<?, ?> editingTemplate; private JTemplate<?, ?> editingTemplate;

3
designer-base/src/com/fr/design/file/MutilTempalteTabPane.java

@ -16,6 +16,7 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.OperatingSystem;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
@ -709,7 +710,7 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M
filename = ((FileNodeFILE) openedTemplate.get(selectedIndex).getEditingFILE()).getEnvPath() + File.separator + filename; filename = ((FileNodeFILE) openedTemplate.get(selectedIndex).getEditingFILE()).getEnvPath() + File.separator + filename;
} }
filename = filename.replaceAll("/", "\\\\"); filename = OperatingSystem.isWindows() ? filename.replaceAll("/", "\\\\") : filename.replaceAll("\\\\", "/");
if (!specifiedTemplate.isALLSaved()) { if (!specifiedTemplate.isALLSaved()) {
specifiedTemplate.stopEditing(); specifiedTemplate.stopEditing();

5
designer-base/src/com/fr/design/gui/controlpane/UIListControlPane.java

@ -219,8 +219,9 @@ public abstract class UIListControlPane extends UIControlPane {
return; return;
} }
for (Nameable aNameableArray : nameableArray) { listModel.setSize(nameableArray.length);
listModel.addElement(new ListModelElement(aNameableArray)); for (int i = 0; i < nameableArray.length; i++) {
listModel.set(i, new ListModelElement(nameableArray[i]));
} }
if (listModel.size() > 0 || this.nameableList.getSelectedIndex() != 0) { if (listModel.size() > 0 || this.nameableList.getSelectedIndex() != 0) {

11
designer-base/src/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java

@ -5,6 +5,7 @@ import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver; import com.fr.design.event.GlobalNameObserver;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -132,13 +133,19 @@ public abstract class AbstractAttrNoScrollPane extends BasicPane {
/** /**
* 返回图标的路径 * 返回图标的路径
*/ */
public abstract String getIconPath(); public String getIconPath() {
// 默认为空,子类有需要再重写
return StringUtils.EMPTY;
}
/** /**
* 界面标题 * 界面标题
* @return 标题 * @return 标题
*/ */
public abstract String title4PopupWindow(); public String title4PopupWindow() {
// 默认为空,子类有需要再重写
return StringUtils.EMPTY;
}
/** /**
* 设置选中的ID, 用于双击展示界面. * 设置选中的ID, 用于双击展示界面.

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

4
designer-base/src/com/fr/design/gui/icheckbox/UICheckBox.java

@ -137,10 +137,12 @@ public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObser
g.setColor(b.getBackground()); g.setColor(b.getBackground());
g.fillRect(0, 0, size.width, size.height); g.fillRect(0, 0, size.width, size.height);
} }
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
if ( model.isSelected()) { if ( model.isSelected()) {
GUIPaintUtils.fillPaint(g2d, iconRect.x, iconRect.y, iconRect.width, iconRect.height,false, Constants.NULL,UIConstants.CHECKBOX_HOVER_SELECTED, 0); GUIPaintUtils.fillPaint(g2d, iconRect.x, iconRect.y, iconRect.width, iconRect.height,false, Constants.NULL,
model.isEnabled() ? UIConstants.CHECKBOX_HOVER_SELECTED : UIConstants.DISABLED_ICON_COLOR, 0);
} else if (model.isRollover() && ! model.isSelected()) { } else if (model.isRollover() && ! model.isSelected()) {
g.setColor(UIConstants.CHECKBOX_HOVER_SELECTED); g.setColor(UIConstants.CHECKBOX_HOVER_SELECTED);
g2d.drawRoundRect(iconRect.x, iconRect.y, iconRect.width - 1, iconRect.height - 1, UIConstants.ARC, UIConstants.ARC); g2d.drawRoundRect(iconRect.x, iconRect.y, iconRect.width - 1, iconRect.height - 1, UIConstants.ARC, UIConstants.ARC);

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>

21
designer-base/src/com/fr/design/mainframe/DesignerFrame.java

@ -17,6 +17,7 @@ import com.fr.design.actions.core.ActionFactory;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.event.DesignerOpenedListener;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
@ -96,6 +97,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
private static final Integer TOP_LAYER = new Integer((200)); private static final Integer TOP_LAYER = new Integer((200));
private static java.util.List<App<?>> appList = new java.util.ArrayList<App<?>>(); private static java.util.List<App<?>> appList = new java.util.ArrayList<App<?>>();
private List<DesignerOpenedListener> designerOpenedListenerList = new ArrayList<>();
private ToolBarMenuDock ad; private ToolBarMenuDock ad;
private DesktopCardPane centerTemplateCardPane; private DesktopCardPane centerTemplateCardPane;
@ -288,6 +291,22 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
} }
} }
/**
* 注册"设计器初始化完成"的监听
*/
public void addDesignerOpenedListener(DesignerOpenedListener listener) {
designerOpenedListenerList.add(listener);
}
/**
* 触发"设计器初始化完成"事件
*/
public void fireDesignerOpened() {
for (DesignerOpenedListener listener : designerOpenedListenerList) {
listener.designerOpened();
}
}
protected DesktopCardPane getCenterTemplateCardPane() { protected DesktopCardPane getCenterTemplateCardPane() {
return centerTemplateCardPane; return centerTemplateCardPane;
} }
@ -928,8 +947,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
} else { } else {
this.addAndActivateJTemplate(jt); this.addAndActivateJTemplate(jt);
} }
//REPORT-5084:激活后刷新一下右側面板
jt.refreshEastPropertiesPane();
} }
/** /**

16
designer-base/src/com/fr/design/mainframe/EastRegionContainerPane.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
@ -81,7 +82,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
* *
* @return * @return
*/ */
public static final EastRegionContainerPane getInstance() { public static EastRegionContainerPane getInstance() {
if (THIS == null) { if (THIS == null) {
THIS = new EastRegionContainerPane(); THIS = new EastRegionContainerPane();
THIS.setLastContainerWidth(DesignerEnvManager.getEnvManager().getLastEastRegionContainerWidth()); THIS.setLastContainerWidth(DesignerEnvManager.getEnvManager().getLastEastRegionContainerWidth());
@ -230,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();
@ -357,10 +365,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
propertyItemMap.get(KEY_WIDGET_SETTINGS).replaceHeaderPane(paraPane); propertyItemMap.get(KEY_WIDGET_SETTINGS).replaceHeaderPane(paraPane);
} }
public void setParameterHeight(int height) {
// stub
}
public static void main(String[] args){ public static void main(String[] args){
JFrame jf = new JFrame("test"); JFrame jf = new JFrame("test");
// jf = new JFrame("test"); // jf = new JFrame("test");
@ -436,7 +440,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
// 无可用 tab 时,显示提示文字 // 无可用 tab 时,显示提示文字
if (!hasAvailableTab) { if (!hasAvailableTab) {
resetPropertyIcons(); resetPropertyIcons();
if (!hasEnabledTab && BaseUtils.isAuthorityEditing()) { if (!hasEnabledTab && DesignerMode.isAuthorityEditing()) {
propertyCard.show(rightPane, DEFAULT_AUTHORITY_PANE); propertyCard.show(rightPane, DEFAULT_AUTHORITY_PANE);
} else { } else {
propertyCard.show(rightPane, DEFAULT_PANE); propertyCard.show(rightPane, DEFAULT_PANE);

27
designer-base/src/com/fr/design/mainframe/JSliderPane.java

@ -6,6 +6,7 @@ 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.ibutton.UISliderButton; import com.fr.design.gui.ibutton.UISliderButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.gui.islider.UISlider; import com.fr.design.gui.islider.UISlider;
import com.fr.design.gui.ispinner.UIBasicSpinner; import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.gui.ispinner.UISpinnerUI; import com.fr.design.gui.ispinner.UISpinnerUI;
@ -21,7 +22,6 @@ import javax.swing.JButton;
import javax.swing.JFormattedTextField; import javax.swing.JFormattedTextField;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JRadioButton; import javax.swing.JRadioButton;
import javax.swing.JSeparator; import javax.swing.JSeparator;
import javax.swing.JSpinner; import javax.swing.JSpinner;
@ -41,6 +41,7 @@ import java.awt.Font;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Image; import java.awt.Image;
import java.awt.Insets;
import java.awt.Point; import java.awt.Point;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -59,22 +60,15 @@ public class JSliderPane extends JPanel {
private static final double ONEPOINTEIGHT = 1.8; private static final double ONEPOINTEIGHT = 1.8;
private static final int SIX = 6; private static final int SIX = 6;
private static final int TEN = 10; private static final int TEN = 10;
private static final int ONE_EIGHT = 18;
private static final int FONT_SIZE = 12; private static final int FONT_SIZE = 12;
private static final int SPINNER_WIDTH = 45; private static final int SPINNER_WIDTH = 45;
private static final int SPINNER_HEIGHT = 20; private static final int SPINNER_HEIGHT = 20;
private static final int HALF_HUNDRED = 50; private static final int HALF_HUNDRED = 50;
private static final int HUNDRED = 100; private static final int HUNDRED = 100;
private static final int TWO_HUNDRED = 200; private static final int TWO_HUNDRED = 200;
private static final int THREE_HUNDRED = 300;
private static final int FOUR_HUNDRED = 400; private static final int FOUR_HUNDRED = 400;
private static final int DIALOG_WIDTH = 157;
private static final int DIALOG_HEIGHT = 192;
private static final int SLIDER_WIDTH = 220;
private static final int SLIDER_HEIGHT = 20;
private static final int SHOWVALBUTTON_WIDTH = 40; private static final int SHOWVALBUTTON_WIDTH = 40;
private static final int SHOWVALBUTTON_HEIGHTH = 20; private static final int SHOWVALBUTTON_HEIGHTH = 20;
private static final int SLIDER_GAP = 5;
private static final int TOOLTIP_Y = 30; private static final int TOOLTIP_Y = 30;
private static final Color BACK_COLOR = new Color(245, 245, 247); private static final Color BACK_COLOR = new Color(245, 245, 247);
@ -427,14 +421,14 @@ public class JSliderPane extends JPanel {
dialog = new PopupPane(upButton, dialogContentPanel); dialog = new PopupPane(upButton, dialogContentPanel);
if (upButtonX == 0) { if (upButtonX == 0) {
upButtonX = btnCoords.x; upButtonX = btnCoords.x;
GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT); GUICoreUtils.showPopupMenu(dialog, upButton, -dialog.getPreferredSize().width + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -dialog.getPreferredSize().height);
} }
} else { } else {
if (upButtonX == 0) { if (upButtonX == 0) {
upButtonX = btnCoords.x; upButtonX = btnCoords.x;
GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT); GUICoreUtils.showPopupMenu(dialog, upButton, -dialog.getPreferredSize().width + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -dialog.getPreferredSize().height);
} else { } else {
GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT); GUICoreUtils.showPopupMenu(dialog, upButton, -dialog.getPreferredSize().width + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -dialog.getPreferredSize().height);
} }
} }
} }
@ -503,9 +497,12 @@ class JSliderPaneUI extends BasicSliderUI {
} }
class PopupPane extends JPopupMenu { class PopupPane extends UIPopupMenu {
private static final float REC = 8f;
private static final int INSERT_TOPBOTTOM = 10;
private static final int INSERT_LEFTRIGHT = 2;
private static final int DIALOG_WIDTH = 157; private static final int DIALOG_WIDTH = 157;
private static final int DIALOG_HEIGHT = 192; private static final int DIALOG_HEIGHT = 205;
PopupPane(JButton b, JPanel dialogContentPanel) { PopupPane(JButton b, JPanel dialogContentPanel) {
this.add(dialogContentPanel, BorderLayout.CENTER); this.add(dialogContentPanel, BorderLayout.CENTER);
@ -513,5 +510,7 @@ class PopupPane extends JPopupMenu {
this.setBackground(new Color(245, 245, 247)); this.setBackground(new Color(245, 245, 247));
} }
public Insets getInsets() {
return new Insets(INSERT_TOPBOTTOM, INSERT_LEFTRIGHT, INSERT_TOPBOTTOM, INSERT_LEFTRIGHT);
}
} }

28
designer-base/src/com/fr/design/mainframe/JTemplate.java

@ -557,15 +557,25 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
operation == FILEChooserPane.OK_OPTION; operation == FILEChooserPane.OK_OPTION;
} }
private boolean saveAsTemplate(boolean isShowLoc) { public boolean saveAsTemplate(boolean isShowLoc) {
FILE editingFILE = this.getEditingFILE(); FILE editingFILE = this.getEditingFILE();
if (editingFILE == null) { if (editingFILE == null) {
return false; return false;
} }
return saveAsTemplate(isShowLoc, editingFILE.getName());
}
/**
* 保存
* @param isShowLoc 是否显示报表运行环境外的路径(C盘D盘等)
* @param fileName 保存文件名
* @return
*/
public boolean saveAsTemplate(boolean isShowLoc, String fileName) {
String oldName = this.getFullPathName(); String oldName = this.getFullPathName();
// alex:如果是SaveAs的话需要让用户来选择路径了 // alex:如果是SaveAs的话需要让用户来选择路径了
FILEChooserPane fileChooser = getFILEChooserPane(isShowLoc); FILEChooserPane fileChooser = getFILEChooserPane(isShowLoc);
fileChooser.setFileNameTextField(editingFILE.getName(), this.suffix()); fileChooser.setFileNameTextField(fileName, this.suffix());
int chooseResult = fileChooser.showSaveDialog(DesignerContext.getDesignerFrame(), this.suffix()); int chooseResult = fileChooser.showSaveDialog(DesignerContext.getDesignerFrame(), this.suffix());
if (isCancelOperation(chooseResult)) { if (isCancelOperation(chooseResult)) {
@ -1000,10 +1010,24 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
return UIConstants.RUN_BIG_ICON; return UIConstants.RUN_BIG_ICON;
} }
/**
* 获取所有参数
*
* @return
*/
public Parameter[] getParameters() { public Parameter[] getParameters() {
return new Parameter[0]; return new Parameter[0];
} }
/**
* 获取模板参数
*
* @return
*/
public Parameter[] getJTemplateParameters() {
return new Parameter[0];
}
/** /**
* 请求表单焦点 * 请求表单焦点
*/ */

4
designer-base/src/com/fr/design/mainframe/JVirtualTemplate.java

@ -12,6 +12,7 @@ import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
import com.fr.stable.OperatingSystem;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
@ -41,7 +42,8 @@ public class JVirtualTemplate extends JTemplate {
if (editingFileName.startsWith(ProjectConstants.REPORTLETS_NAME)) { if (editingFileName.startsWith(ProjectConstants.REPORTLETS_NAME)) {
editingFileName = ((FileNodeFILE) getEditingFILE()).getEnvPath() + File.separator + editingFileName; editingFileName = ((FileNodeFILE) getEditingFILE()).getEnvPath() + File.separator + editingFileName;
} }
return editingFileName.replaceAll("/", "\\\\"); editingFileName = OperatingSystem.isWindows() ? editingFileName.replaceAll("/", "\\\\") : editingFileName.replaceAll("\\\\", "/");
return editingFileName;
} }
/** /**

2
designer-base/src/com/fr/design/mainframe/backgroundpane/ImageBackgroundQuickPane.java

@ -47,7 +47,7 @@ public class ImageBackgroundQuickPane extends BackgroundQuickPane {
public ImageBackgroundQuickPane(boolean hasImageLayout) { public ImageBackgroundQuickPane(boolean hasImageLayout) {
this.setLayout(new BorderLayout(0, 4)); this.setLayout(new BorderLayout(0, 4));
String[] nameArray = {Inter.getLocText("FR-Background_Image_Default"), Inter.getLocText("FR-Background_Image_Titled"), Inter.getLocText("FR-Background_Image_Adjust"), Inter.getLocText("FR-Background_Image_Extend")}; String[] nameArray = {Inter.getLocText("FR-Background_Image_Default"), Inter.getLocText("FR-Background_Image_Titled"), Inter.getLocText("FR-Background_Image_Extend"), Inter.getLocText("FR-Background_Image_Adjust")};
Byte[] valueArray = {Constants.IMAGE_CENTER, Constants.IMAGE_TILED, Constants.IMAGE_EXTEND, Constants.IMAGE_ADJUST}; Byte[] valueArray = {Constants.IMAGE_CENTER, Constants.IMAGE_TILED, Constants.IMAGE_EXTEND, Constants.IMAGE_ADJUST};
imageLayoutPane = new UIButtonGroup<Byte>(nameArray, valueArray); imageLayoutPane = new UIButtonGroup<Byte>(nameArray, valueArray);
imageLayoutPane.setSelectedIndex(0); imageLayoutPane.setSelectedIndex(0);

30
designer-base/src/com/fr/design/mainframe/widget/BasicPropertyPane.java

@ -13,6 +13,10 @@ import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
/** /**
* Created by plough on 2017/8/7. * Created by plough on 2017/8/7.
@ -27,7 +31,31 @@ public class BasicPropertyPane extends BasicPane {
protected void initContentPane() { protected void initContentPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
widgetName = new UITextField(); widgetName = new UITextField() {
protected void initListener() {
if (shouldResponseChangeListener()) {
addFocusListener(new FocusListener() {
@Override
public void focusGained(FocusEvent e) {
}
@Override
public void focusLost(FocusEvent e) {
attributeChange();
}
});
addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
attributeChange();
}
}
});
}
}
};
widgetName.setGlobalName(Inter.getLocText("FR-Designer_Basic")); widgetName.setGlobalName(Inter.getLocText("FR-Designer_Basic"));
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;

47
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,49 @@ 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;
}
} }

1
designer-base/src/com/fr/start/BaseDesigner.java

@ -93,6 +93,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
+ DesignerEnvManager.getEnvManager().getLastOpenFile()); + DesignerEnvManager.getEnvManager().getLastOpenFile());
} }
isException = openFile(df, isException, file); isException = openFile(df, isException, file);
df.fireDesignerOpened();
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
if (!isException) { if (!isException) {

3
designer-form/src/com/fr/design/designer/beans/actions/CopyAction.java

@ -1,6 +1,7 @@
package com.fr.design.designer.beans.actions; package com.fr.design.designer.beans.actions;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.designer.beans.actions.behavior.ComponentEnable;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -18,6 +19,7 @@ public class CopyAction extends FormWidgetEditAction {
this.setMnemonic('C'); this.setMnemonic('C');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png"));
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER)); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER));
setUpdateBehavior(new ComponentEnable());
} }
@Override @Override
@ -28,5 +30,4 @@ public class CopyAction extends FormWidgetEditAction {
} }
return false; return false;
} }
} }

3
designer-form/src/com/fr/design/designer/beans/actions/CutAction.java

@ -6,6 +6,7 @@ import java.awt.event.KeyEvent;
import javax.swing.KeyStroke; import javax.swing.KeyStroke;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.designer.beans.actions.behavior.ComponentEnable;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
@ -19,6 +20,7 @@ public class CutAction extends FormWidgetEditAction {
this.setMnemonic('T'); this.setMnemonic('T');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/cut.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/cut.png"));
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER)); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER));
this.setUpdateBehavior(new ComponentEnable());
} }
@Override @Override
@ -29,5 +31,4 @@ public class CutAction extends FormWidgetEditAction {
} }
return editPane.cut(); return editPane.cut();
} }
} }

8
designer-form/src/com/fr/design/designer/beans/actions/FormDeleteAction.java

@ -8,6 +8,7 @@ import java.awt.event.KeyEvent;
import javax.swing.*; import javax.swing.*;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.designer.beans.actions.behavior.ComponentEnable;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
@ -27,6 +28,13 @@ public class FormDeleteAction extends FormWidgetEditAction {
// Richie:删除菜单图标 // Richie:删除菜单图标
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/delete.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/delete.png"));
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0)); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0));
this.setUpdateBehavior(new ComponentEnable());
}
@Override
protected String getToolTipText() {
String originText = super.getToolTipText();
return originText.replace(KeyEvent.getKeyText(KeyEvent.VK_BACK_SPACE), KeyEvent.getKeyText(KeyEvent.VK_DELETE));
} }
@Override @Override

17
designer-form/src/com/fr/design/designer/beans/actions/FormWidgetEditAction.java

@ -1,23 +1,32 @@
package com.fr.design.designer.beans.actions; package com.fr.design.designer.beans.actions;
import com.fr.design.actions.TemplateComponentAction; import com.fr.design.actions.TemplateComponentAction;
import com.fr.design.designer.beans.actions.behavior.UpdateBehavior;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.general.Inter;
import com.fr.plugin.ExtraClassManager; import com.fr.plugin.ExtraClassManager;
import com.fr.stable.ReportFunctionProcessor; import com.fr.stable.ReportFunctionProcessor;
import com.fr.stable.fun.FunctionProcessor; import com.fr.stable.fun.FunctionProcessor;
import javax.swing.JButton; import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
public abstract class FormWidgetEditAction extends TemplateComponentAction<FormDesigner> { public abstract class FormWidgetEditAction extends TemplateComponentAction<FormDesigner> {
private UpdateBehavior updateBehavior = new UpdateBehavior<FormWidgetEditAction>() {
@Override
public void doUpdate(FormWidgetEditAction action) {
action.setEnabled(true);
}
};
protected FormWidgetEditAction(FormDesigner t) { protected FormWidgetEditAction(FormDesigner t) {
super(t); super(t);
} }
@Override @Override
public void update() { public void update() {
this.setEnabled(true); updateBehavior.doUpdate(this);
} }
@Override @Override
@ -36,4 +45,8 @@ public abstract class FormWidgetEditAction extends TemplateComponentAction<FormD
} }
} }
public void setUpdateBehavior(UpdateBehavior updateBehavior) {
this.updateBehavior = updateBehavior;
}
} }

12
designer-form/src/com/fr/design/designer/beans/actions/MoveDownAction.java

@ -1,6 +1,7 @@
package com.fr.design.designer.beans.actions; package com.fr.design.designer.beans.actions;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.designer.beans.actions.behavior.MovableDownEnable;
import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
@ -28,6 +29,7 @@ public class MoveDownAction extends FormWidgetEditAction {
this.setMnemonic('B'); this.setMnemonic('B');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/down.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/down.png"));
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, DEFAULT_MODIFIER)); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, DEFAULT_MODIFIER));
this.setUpdateBehavior(new MovableDownEnable());
} }
@Override @Override
@ -47,14 +49,4 @@ public class MoveDownAction extends FormWidgetEditAction {
designer.getEditListenerTable().fireCreatorModified(creator, DesignerEvent.CREATOR_SELECTED); designer.getEditListenerTable().fireCreatorModified(creator, DesignerEvent.CREATOR_SELECTED);
return true; return true;
} }
@Override
public void update() {
FormDesigner designer = getEditingComponent();
if (designer == null) {
this.setEnabled(false);
return;
}
this.setEnabled(designer.isCurrentComponentMovableDown());
}
} }

21
designer-form/src/com/fr/design/designer/beans/actions/MoveToBottomAction.java

@ -1,6 +1,7 @@
package com.fr.design.designer.beans.actions; package com.fr.design.designer.beans.actions;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.designer.beans.actions.behavior.MovableDownEnable;
import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
@ -27,7 +28,14 @@ public class MoveToBottomAction extends FormWidgetEditAction {
this.setName(Inter.getLocText("FR-Designer_Move_To_Bottom")); this.setName(Inter.getLocText("FR-Designer_Move_To_Bottom"));
this.setMnemonic('K'); this.setMnemonic('K');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/to_bottom.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/to_bottom.png"));
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, DEFAULT_MODIFIER + InputEvent.ALT_MASK)); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, DEFAULT_MODIFIER + InputEvent.SHIFT_MASK));
this.setUpdateBehavior(new MovableDownEnable());
}
@Override
protected String getToolTipText() {
String originText = super.getToolTipText();
return originText.replace(KeyEvent.getKeyText(KeyEvent.VK_OPEN_BRACKET), "[");
} }
@Override @Override
@ -47,15 +55,4 @@ public class MoveToBottomAction extends FormWidgetEditAction {
designer.getEditListenerTable().fireCreatorModified(creator, DesignerEvent.CREATOR_SELECTED); designer.getEditListenerTable().fireCreatorModified(creator, DesignerEvent.CREATOR_SELECTED);
return true; return true;
} }
@Override
public void update() {
FormDesigner designer = getEditingComponent();
if (designer == null) {
this.setEnabled(false);
return;
}
this.setEnabled(designer.isCurrentComponentMovableDown());
}
} }

21
designer-form/src/com/fr/design/designer/beans/actions/MoveToTopAction.java

@ -1,6 +1,7 @@
package com.fr.design.designer.beans.actions; package com.fr.design.designer.beans.actions;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.designer.beans.actions.behavior.MovableUpEnable;
import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
@ -27,7 +28,14 @@ public class MoveToTopAction extends FormWidgetEditAction {
this.setName(Inter.getLocText("FR-Designer_Move_To_Top")); this.setName(Inter.getLocText("FR-Designer_Move_To_Top"));
this.setMnemonic('T'); this.setMnemonic('T');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/to_top.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/to_top.png"));
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_CLOSE_BRACKET, DEFAULT_MODIFIER + InputEvent.ALT_MASK)); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_CLOSE_BRACKET, DEFAULT_MODIFIER + InputEvent.SHIFT_MASK));
this.setUpdateBehavior(new MovableUpEnable());
}
@Override
protected String getToolTipText() {
String originText = super.getToolTipText();
return originText.replace(KeyEvent.getKeyText(KeyEvent.VK_CLOSE_BRACKET), "]");
} }
@Override @Override
@ -46,15 +54,4 @@ public class MoveToTopAction extends FormWidgetEditAction {
designer.getEditListenerTable().fireCreatorModified(creator, DesignerEvent.CREATOR_SELECTED); designer.getEditListenerTable().fireCreatorModified(creator, DesignerEvent.CREATOR_SELECTED);
return true; return true;
} }
@Override
public void update() {
FormDesigner designer = getEditingComponent();
if (designer == null) {
this.setEnabled(false);
return;
}
this.setEnabled(designer.isCurrentComponentMovableUp());
}
} }

14
designer-form/src/com/fr/design/designer/beans/actions/MoveUpAction.java

@ -1,6 +1,7 @@
package com.fr.design.designer.beans.actions; package com.fr.design.designer.beans.actions;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.designer.beans.actions.behavior.MovableUpEnable;
import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
@ -27,6 +28,7 @@ public class MoveUpAction extends FormWidgetEditAction {
this.setMnemonic('F'); this.setMnemonic('F');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/up.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/up.png"));
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_CLOSE_BRACKET, DEFAULT_MODIFIER)); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_CLOSE_BRACKET, DEFAULT_MODIFIER));
this.setUpdateBehavior(new MovableUpEnable());
} }
@Override @Override
@ -43,18 +45,8 @@ public class MoveUpAction extends FormWidgetEditAction {
return false; return false;
} }
container.setComponentZOrder(creator, targetIndex); container.setComponentZOrder(creator, targetIndex);
designer.getEditListenerTable().fireCreatorModified(creator, DesignerEvent.CREATOR_SELECTED); designer.getEditListenerTable().fireCreatorModified(creator, DesignerEvent.CREATOR_SELECTED);
return true; return true;
} }
@Override
public void update() {
FormDesigner designer = getEditingComponent();
if (designer == null) {
this.setEnabled(false);
return;
}
this.setEnabled(designer.isCurrentComponentMovableUp());
}
} }

20
designer-form/src/com/fr/design/designer/beans/actions/behavior/ComponentEnable.java

@ -0,0 +1,20 @@
package com.fr.design.designer.beans.actions.behavior;
import com.fr.design.designer.beans.actions.FormWidgetEditAction;
import com.fr.design.mainframe.FormDesigner;
/**
* 只对控件有效对底层布局form/body无效
* Created by plough on 2018/1/19.
*/
public class ComponentEnable implements UpdateBehavior<FormWidgetEditAction> {
@Override
public void doUpdate(FormWidgetEditAction action) {
FormDesigner designer = action.getEditingComponent();
if (designer == null) {
action.setEnabled(false);
return;
}
action.setEnabled(!designer.isRootSelected());
}
}

19
designer-form/src/com/fr/design/designer/beans/actions/behavior/MovableDownEnable.java

@ -0,0 +1,19 @@
package com.fr.design.designer.beans.actions.behavior;
import com.fr.design.designer.beans.actions.FormWidgetEditAction;
import com.fr.design.mainframe.FormDesigner;
/**
* Created by plough on 2018/1/19.
*/
public class MovableDownEnable implements UpdateBehavior<FormWidgetEditAction> {
@Override
public void doUpdate(FormWidgetEditAction action) {
FormDesigner designer = action.getEditingComponent();
if (designer == null) {
action.setEnabled(false);
return;
}
action.setEnabled(designer.isCurrentComponentMovableDown());
}
}

19
designer-form/src/com/fr/design/designer/beans/actions/behavior/MovableUpEnable.java

@ -0,0 +1,19 @@
package com.fr.design.designer.beans.actions.behavior;
import com.fr.design.designer.beans.actions.FormWidgetEditAction;
import com.fr.design.mainframe.FormDesigner;
/**
* Created by plough on 2018/1/19.
*/
public class MovableUpEnable implements UpdateBehavior<FormWidgetEditAction> {
@Override
public void doUpdate(FormWidgetEditAction action) {
FormDesigner designer = action.getEditingComponent();
if (designer == null) {
action.setEnabled(false);
return;
}
action.setEnabled(designer.isCurrentComponentMovableUp());
}
}

8
designer-form/src/com/fr/design/designer/beans/actions/behavior/UpdateBehavior.java

@ -0,0 +1,8 @@
package com.fr.design.designer.beans.actions.behavior;
/**
* Created by plough on 2018/1/19.
*/
public interface UpdateBehavior<T> {
public void doUpdate(T t);
}

48
designer-form/src/com/fr/design/designer/creator/XCreator.java

@ -3,8 +3,8 @@
*/ */
package com.fr.design.designer.creator; package com.fr.design.designer.creator;
import com.fr.base.BaseUtils;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
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;
@ -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;
@ -294,7 +296,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
*/ */
@Override @Override
public JComponent createToolPane(BaseJForm jform, FormDesigner formEditor) { public JComponent createToolPane(BaseJForm jform, FormDesigner formEditor) {
if (!BaseUtils.isAuthorityEditing()) { if (!DesignerMode.isAuthorityEditing()) {
if (isDedicateContainer()) { if (isDedicateContainer()) {
// 图表块和报表块由于控件树处不显示,但对应的属性表要显示,此处处理下 // 图表块和报表块由于控件树处不显示,但对应的属性表要显示,此处处理下
XCreator child = ((XLayoutContainer) this).getXCreator(0); XCreator child = ((XLayoutContainer) this).getXCreator(0);
@ -410,6 +412,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
* 重置组件的名称 * 重置组件的名称
* @param name 名称 * @param name 名称
*/ */
@Override
public void resetCreatorName(String name) { public void resetCreatorName(String name) {
toData().setWidgetName(name); toData().setWidgetName(name);
} }
@ -426,6 +429,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
* 返回编辑的子组件scale为其内部组件 * 返回编辑的子组件scale为其内部组件
* @return 组件 * @return 组件
*/ */
@Override
public XCreator getEditingChildCreator() { public XCreator getEditingChildCreator() {
return this; return this;
} }
@ -434,6 +438,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
* 返回对应属性表的组件scale和title返回其子组件 * 返回对应属性表的组件scale和title返回其子组件
* @return 组件 * @return 组件
*/ */
@Override
public XCreator getPropertyDescriptorCreator() { public XCreator getPropertyDescriptorCreator() {
return this; return this;
} }
@ -442,6 +447,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
* 更新子组件的Bound; 没有不处理 * 更新子组件的Bound; 没有不处理
* @param minHeight 最小高度 * @param minHeight 最小高度
*/ */
@Override
public void updateChildBound(int minHeight) { public void updateChildBound(int minHeight) {
return; return;
} }
@ -450,6 +456,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
* 是否作为控件树的叶子节点 * 是否作为控件树的叶子节点
* @return 是则返回true * @return 是则返回true
*/ */
@Override
public boolean isComponentTreeLeaf() { public boolean isComponentTreeLeaf() {
return true; return true;
} }
@ -458,6 +465,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
* 是否为sclae和title专属容器 * 是否为sclae和title专属容器
* @return 是则返回true * @return 是则返回true
*/ */
@Override
public boolean isDedicateContainer() { public boolean isDedicateContainer() {
return false; return false;
} }
@ -630,7 +638,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描述信息
@ -640,7 +672,6 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
if (widget != null) { if (widget != null) {
setXDescrption(widget.getDescription()); setXDescrption(widget.getDescription());
} }
} }
/** /**
@ -699,7 +730,6 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
// do nothing // do nothing
} }
/** /**
* 编辑状态的时候需要重新绘制下边框 * 编辑状态的时候需要重新绘制下边框
* *
@ -732,4 +762,12 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
return true; return true;
} }
/**
* 是否支持共享-现只支持报表块图表tab块绝对布局
* @return
*/
public boolean isSupportShared() {
return false;
}
} }

2
designer-form/src/com/fr/design/designer/creator/XCreatorTools.java

@ -18,7 +18,6 @@ public interface XCreatorTools {
* @param path 控件树list * @param path 控件树list
*/ */
void notShowInComponentTree(List<Component> path); void notShowInComponentTree(List<Component> path);
/** /**
* 重置组件的名称 * 重置组件的名称
* @param name 名称 * @param name 名称
@ -60,5 +59,4 @@ public interface XCreatorTools {
* @return 组件 * @return 组件
*/ */
Component getParentShow(); Component getParentShow();
} }

33
designer-form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java

@ -16,9 +16,11 @@ 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.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;
@ -32,7 +34,16 @@ import com.fr.share.ShareConstants;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import javax.swing.Icon; import javax.swing.Icon;
import java.awt.*; import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Composite;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.Toolkit;
import java.awt.event.ContainerEvent; import java.awt.event.ContainerEvent;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
@ -46,8 +57,8 @@ 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);
@ -58,6 +69,8 @@ public class XWAbsoluteLayout extends XLayoutContainer {
//由于屏幕分辨率不同,界面上的容器大小可能不是默认的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() {
@ -501,7 +514,6 @@ public class XWAbsoluteLayout extends XLayoutContainer {
super.paintBorder(g, bounds); super.paintBorder(g, bounds);
} }
} }
/** /**
* 响应点击事件 * 响应点击事件
* *
@ -509,6 +521,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() ||
@ -564,4 +581,12 @@ public class XWAbsoluteLayout extends XLayoutContainer {
public boolean supportInnerOrderChangeActions() { public boolean supportInnerOrderChangeActions() {
return true; return true;
} }
/**
* 是否支持共享-现只支持报表块图表tab块绝对布局
* @return
*/
public boolean isSupportShared() {
return true;
}
} }

25
designer-form/src/com/fr/design/designer/creator/XWFitLayout.java

@ -28,6 +28,9 @@ import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import javax.swing.JOptionPane;
/** /**
* @author jim * @author jim
* @date 2014-6-23 * @date 2014-6-23
@ -718,6 +721,20 @@ public class XWFitLayout extends XLayoutContainer {
return rec; return rec;
} }
/**
* 界面容器大小不是默认的时恢复组件实际大小
*/
private Rectangle dealWgtBound(Rectangle rec) {
if (containerPercent == 1.0) {
return rec;
}
rec.x = (int) (rec.x * containerPercent);
rec.y = (int) (rec.y * containerPercent);
rec.width = (int) (rec.width * containerPercent);
rec.height = (int) (rec.height * containerPercent);
return rec;
}
/** /**
* 新增删除拉伸后更新每个组件的BoundsWidget * 新增删除拉伸后更新每个组件的BoundsWidget
*/ */
@ -758,6 +775,10 @@ public class XWFitLayout extends XLayoutContainer {
} }
//如果子组件是绝对布局,则内部的widget也要更新 //如果子组件是绝对布局,则内部的widget也要更新
if (creator.acceptType(XWAbsoluteLayout.class)){ if (creator.acceptType(XWAbsoluteLayout.class)){
//更新的时候一定要带上backupBound
if (creator.getBackupBound() == null && wgt.getBeforeScaleBounds() != null) {
creator.setBackupBound(dealWgtBound(wgt.getBeforeScaleBounds()));
}
((XWAbsoluteLayout) creator).updateBoundsWidget(); ((XWAbsoluteLayout) creator).updateBoundsWidget();
creator.setBackupBound(creator.getBounds()); creator.setBackupBound(creator.getBounds());
} }
@ -958,11 +979,13 @@ public class XWFitLayout extends XLayoutContainer {
public boolean canAddInterval(int interval) { public boolean canAddInterval(int interval) {
int val = interval/2; int val = interval/2;
for (int i=0, len=this.getComponentCount(); i<len; i++) { for (int i=0, len=this.getComponentCount(); i<len; i++) {
Component comp = this.getComponent(i); XCreator comp = (XCreator) this.getComponent(i);
Rectangle rec = comp.getBounds(); Rectangle rec = comp.getBounds();
Dimension d = new Dimension(this.getWidth(), this.getHeight()); Dimension d = new Dimension(this.getWidth(), this.getHeight());
Rectangle bound = dealBound(rec, d, val, 0); Rectangle bound = dealBound(rec, d, val, 0);
if (bound.width < minWidth || bound.height< minHeight) { if (bound.width < minWidth || bound.height< minHeight) {
String widgetName = comp.toData().getWidgetName();
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Engine_Invalid_Setting_Cause_Reach_Min_Widget_Size", widgetName));
return false; return false;
} }
} }

5
designer-form/src/com/fr/design/designer/creator/XWParameterLayout.java

@ -232,4 +232,9 @@ public class XWParameterLayout extends XWAbsoluteLayout {
return false; return false;
} }
@Override
public boolean supportInnerOrderChangeActions() {
return false;
}
} }

2
designer-form/src/com/fr/design/designer/properties/EventPropertyTable.java

@ -72,7 +72,7 @@ public class EventPropertyTable extends UIListControlPane {
} }
private String switchLang(String eventName) { private String switchLang(String eventName) {
return Inter.getLocText("Event-" + eventName); return Inter.getLocText("FR-Engine_Event_" + eventName);
} }
/** /**

BIN
designer-form/src/com/fr/design/form/images/joption_failure.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 900 B

BIN
designer-form/src/com/fr/design/form/images/joption_success.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 891 B

7
designer-form/src/com/fr/design/form/parameter/FormParaDesigner.java

@ -13,7 +13,6 @@ import java.awt.Rectangle;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.swing.Action;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -21,6 +20,7 @@ import javax.swing.JPanel;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.parameter.ParameterUI; import com.fr.base.parameter.ParameterUI;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.designer.beans.actions.CopyAction; import com.fr.design.designer.beans.actions.CopyAction;
@ -107,11 +107,10 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_PARA); EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_PARA);
EastRegionContainerPane.getInstance().replaceWidgetLibPane( EastRegionContainerPane.getInstance().replaceWidgetLibPane(
FormWidgetDetailPane.getInstance(this)); FormWidgetDetailPane.getInstance(this));
if (!BaseUtils.isAuthorityEditing()) { if (!DesignerMode.isAuthorityEditing()) {
ParameterPropertyPane parameterPropertyPane = ParameterPropertyPane.getInstance(this); ParameterPropertyPane parameterPropertyPane = ParameterPropertyPane.getInstance(this); // 传入this的同时会更新参数面板高度
parameterPropertyPane.refreshState(); parameterPropertyPane.refreshState();
EastRegionContainerPane.getInstance().addParameterPane(parameterPropertyPane); EastRegionContainerPane.getInstance().addParameterPane(parameterPropertyPane);
EastRegionContainerPane.getInstance().setParameterHeight(parameterPropertyPane.getPreferredSize().height);
EastRegionContainerPane.getInstance().replaceWidgetSettingsPane( EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(
WidgetPropertyPane.getInstance(this)); WidgetPropertyPane.getInstance(this));
} else { } else {

5
designer-form/src/com/fr/design/mainframe/ComponentTree.java

@ -121,6 +121,11 @@ public class ComponentTree extends JTree {
scrollPathToVisible(treepath[0]); scrollPathToVisible(treepath[0]);
} }
@Override
public void paint(Graphics g) {
super.paint(g);
designer.getSelectionModel(); // 否则参数一个一个加会导致参数面板和body结构出问题
}
/** /**
* 刷新 * 刷新

22
designer-form/src/com/fr/design/mainframe/FormCreatorDropTarget.java

@ -8,31 +8,20 @@ import com.fr.design.designer.beans.HoverPainter;
import com.fr.design.designer.beans.Painter; import com.fr.design.designer.beans.Painter;
import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.beans.models.AddingModel;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.*;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.XWParameterLayout;
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.design.utils.ComponentUtils;
import com.fr.form.share.SharableEditorProvider; import com.fr.form.share.SharableEditorProvider;
import com.fr.form.share.ShareLoader; import com.fr.form.share.ShareLoader;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.ui.SharableWidgetBindInfo; import com.fr.form.ui.SharableWidgetBindInfo;
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;
import javax.swing.BorderFactory; import javax.swing.*;
import javax.swing.JWindow; import java.awt.*;
import java.awt.Color;
import java.awt.Component;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.dnd.DropTarget; import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetDragEvent; import java.awt.dnd.DropTargetDragEvent;
import java.awt.dnd.DropTargetDropEvent; import java.awt.dnd.DropTargetDropEvent;
@ -100,8 +89,9 @@ public class FormCreatorDropTarget extends DropTarget {
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(

50
designer-form/src/com/fr/design/mainframe/FormDesigner.java

@ -1,8 +1,8 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
@ -21,6 +21,7 @@ import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.designer.beans.models.StateModel; import com.fr.design.designer.beans.models.StateModel;
import com.fr.design.designer.creator.*; import com.fr.design.designer.creator.*;
import com.fr.design.designer.properties.FormWidgetAuthorityEditPane; import com.fr.design.designer.properties.FormWidgetAuthorityEditPane;
import com.fr.design.event.DesignerOpenedListener;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
@ -43,10 +44,9 @@ import com.fr.form.ui.WidgetValue;
import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WFitLayout;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.CoreGraphHelper;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
import javax.swing.*; import javax.swing.*;
@ -202,8 +202,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
} }
ParameterPropertyPane.getInstance().getParameterToolbarPane().populateBean( ParameterPropertyPane.getInstance().getParameterToolbarPane().populateBean(
getParameterArray() == null ? new Parameter[0] : getParameterArray()); getParameterArray() == null ? new Parameter[0] : getParameterArray());
ParameterPropertyPane.getInstance().repaintContainer(); ParameterPropertyPane.getInstance(this).repaintContainer(); // 传入this的同时会更新参数面板高度
EastRegionContainerPane.getInstance().setParameterHeight(ParameterPropertyPane.getInstance(this).getPreferredSize().height);
} }
private void removeSame(Parameter[] parameters, List<String> namelist) { private void removeSame(Parameter[] parameters, List<String> namelist) {
@ -350,11 +349,11 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
} }
parameterArray = null; parameterArray = null;
refreshParameter();
//parameter多的时候,不刷新会出现控件边界交叉 //parameter多的时候,不刷新会出现控件边界交叉
refreshRoot(); refreshRoot();
//不知道为什么添加完参数后控件树只有一个label,这儿刷新一下控件树好了 // 最后刷新"添加参数面板"和控件树
EastRegionContainerPane.getInstance().refreshDownPane(); refreshParameter();
} }
private void addParaPaneTooltips() { private void addParaPaneTooltips() {
@ -475,7 +474,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));
//删除后重绘下 //删除后重绘下
@ -679,6 +677,13 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
} }
}); });
DesignerContext.getDesignerFrame().addDesignerOpenedListener(new DesignerOpenedListener() {
@Override
public void designerOpened() {
setToolbarButtons();
}
});
} }
/** /**
@ -1028,7 +1033,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
selected.add((XCreator) path.getLastPathComponent()); selected.add((XCreator) path.getLastPathComponent());
} }
if (!BaseUtils.isAuthorityEditing()) { if (!DesignerMode.isAuthorityEditing()) {
selectionModel.setSelectedCreators(selected); selectionModel.setSelectedCreators(selected);
if (formArea != null) { if (formArea != null) {
@ -1040,8 +1045,21 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
showAuthorityEditPane(); showAuthorityEditPane();
} }
//先选中再检查 //先选中再检查
setToolbarButtons(paths.length == 1 && tree.getSelectionPath().getParentPath() == null); setToolbarButtons();
}
}
/**
* 是否选中了自适应布局或底层form
*/
public boolean isRootSelected() {
ComponentTree tree = FormHierarchyTreePane.getInstance().getComponentTree();
TreePath[] paths = tree.getSelectionPaths();
if (paths == null) {
return true;
} }
boolean isForm = paths.length == 1 && tree.getSelectionPath().getParentPath() == null;
return isForm || isRoot(getSelectionModel().getSelection().getSelectedCreator());
} }
/** /**
@ -1074,9 +1092,9 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
} }
protected void setToolbarButtons(boolean flag) { protected void setToolbarButtons() {
//自适应布局和底层都不能删除 //自适应布局和底层都不能删除
DesignerContext.getDesignerFrame().checkCombineUp(!(isRoot(getSelectionModel().getSelection().getSelectedCreator()) || flag), NAME_ARRAY_LIST); DesignerContext.getDesignerFrame().checkCombineUp(!isRootSelected(), NAME_ARRAY_LIST);
} }
private void invalidateLayout() { private void invalidateLayout() {
@ -1298,7 +1316,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
try { try {
Thread.sleep(1500); Thread.sleep(1500);
} catch (InterruptedException e) { } catch (InterruptedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FRLogger.getLogger().error(e.getMessage(), e);
} }
pane.setLayout(new BorderLayout()); pane.setLayout(new BorderLayout());
@ -1413,7 +1431,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
@Override @Override
public void fireCreatorModified(DesignerEvent evt) { public void fireCreatorModified(DesignerEvent evt) {
if (!BaseUtils.isAuthorityEditing()) { if (!DesignerMode.isAuthorityEditing()) {
return; return;
} }
if (evt.getCreatorEventID() == DesignerEvent.CREATOR_EDITED if (evt.getCreatorEventID() == DesignerEvent.CREATOR_EDITED
@ -1425,7 +1443,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
if (paths == null) { if (paths == null) {
return; return;
} }
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
showAuthorityEditPane(); showAuthorityEditPane();
} }

12
designer-form/src/com/fr/design/mainframe/JForm.java

@ -2,6 +2,7 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.PaperSize; import com.fr.base.PaperSize;
import com.fr.base.Parameter;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.actions.core.WorkBookSupportable;
import com.fr.design.actions.file.WebPreviewUtils; import com.fr.design.actions.file.WebPreviewUtils;
@ -258,9 +259,6 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
private XComponent lastAffectedCreator; private XComponent lastAffectedCreator;
@Override @Override
public void fireCreatorModified(DesignerEvent evt) { public void fireCreatorModified(DesignerEvent evt) {
if (formDesign.getArea() == null || !formDesign.getArea().isValid()) {
return;
}
if (evt.getCreatorEventID() == DesignerEvent.CREATOR_CUTED) { if (evt.getCreatorEventID() == DesignerEvent.CREATOR_CUTED) {
setPropertyPaneChange(formDesign.getRootComponent()); setPropertyPaneChange(formDesign.getRootComponent());
} else if (evt.getCreatorEventID() == DesignerEvent.CREATOR_DELETED) { } else if (evt.getCreatorEventID() == DesignerEvent.CREATOR_DELETED) {
@ -682,6 +680,11 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
return UIConstants.RUN_BIG_ICON; return UIConstants.RUN_BIG_ICON;
} }
@Override
public Parameter[] getJTemplateParameters() {
return this.getTarget().getTemplateParameters();
}
@Override @Override
/** /**
* 创建菜单项Preview * 创建菜单项Preview
@ -740,9 +743,8 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.FORM); EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.FORM);
EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(WidgetPropertyPane.getInstance(formDesign)); EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(WidgetPropertyPane.getInstance(formDesign));
ParameterPropertyPane parameterPropertyPane = ParameterPropertyPane.getInstance(formDesign); ParameterPropertyPane parameterPropertyPane = ParameterPropertyPane.getInstance(formDesign);
parameterPropertyPane.setAddParaPaneVisible(false, this); parameterPropertyPane.refreshState(this);
EastRegionContainerPane.getInstance().addParameterPane(parameterPropertyPane); EastRegionContainerPane.getInstance().addParameterPane(parameterPropertyPane);
EastRegionContainerPane.getInstance().setParameterHeight(parameterPropertyPane.getPreferredSize().height);
refreshWidgetLibPane(); refreshWidgetLibPane();
} }

93
designer-form/src/com/fr/design/mainframe/WidgetHelpDialog.java

@ -0,0 +1,93 @@
package com.fr.design.mainframe;
import com.fr.design.dialog.UIDialog;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itextarea.UITextArea;
import com.fr.general.Inter;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Point;
import java.awt.event.MouseEvent;
/**
* @author zack
* @date 2016-10-14
* @since 8.0
*/
public class WidgetHelpDialog extends UIDialog {
private static final int OUTER_WIDTH = 190;
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 UIScrollPane helpArea;
public WidgetHelpDialog(Frame parent, String helpMsg) {
super(parent);
this.helpMsg = helpMsg;
initHelpArea();
JPanel panel = (JPanel) getContentPane();
initComponents(panel);
setSize(new Dimension(OUTER_WIDTH, OUTER_HEIGHT));
}
private void initHelpArea() {
UITextArea textArea = new UITextArea(helpMsg);
textArea.setEditable(false);
textArea.setBorder(null);
helpArea = new UIScrollPane(textArea);
helpArea.setBounds(0, 0, OUTER_WIDTH, OUTER_HEIGHT);
helpArea.setBorder(null);
}
private void initComponents(JPanel contentPane) {
contentPane.setLayout(new BorderLayout());
add(helpArea, BorderLayout.CENTER);
this.applyClosingAction();
this.setTitle(Inter.getLocText("FR-Designer_Help"));
}
/**
* 打开帮助框
*/
public void showWindow() {
this.setResizable(false);
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);
}
/**
*
*/
@Override
public void checkValid() throws Exception {
}
public void setLocationRelativeTo(JFrame c, int x, int y) {
int dx = 0, dy = 0;
Point compLocation = c.getLocationOnScreen();//获取设计器Jframe坐标作为相对位置原点
setLocation(dx + x, dy + y);
dx = compLocation.x;
dy = compLocation.y + c.getRootPane().getY();//加上底层容器的y坐标(其实就是设计器最上方图标栏的高度)
setLocation(dx + x, dy + y);
}
}

71
designer-form/src/com/fr/design/mainframe/WidgetPropertyPane.java

@ -7,21 +7,18 @@ import com.fr.design.designer.beans.events.DesignerEditListener;
import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.*; import com.fr.design.designer.creator.*;
import com.fr.design.designer.properties.EventPropertyTable; import com.fr.design.designer.properties.EventPropertyTable;
import com.fr.design.dialog.BasicPane;
import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.ibutton.UIHeadGroup;
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.itable.AbstractPropertyTable; import com.fr.design.gui.itable.AbstractPropertyTable;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.widget.ui.FormWidgetCardPane; import com.fr.design.mainframe.widget.ui.FormWidgetCardPane;
import com.fr.design.widget.ui.designer.mobile.MobileWidgetDefinePane; import com.fr.design.widget.ui.designer.mobile.MobileWidgetDefinePane;
import com.fr.form.ui.Widget;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.LineBorder;
import javax.swing.table.JTableHeader;
import java.awt.*; import java.awt.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -33,22 +30,15 @@ import java.util.Set;
*/ */
public class WidgetPropertyPane extends FormDockView implements BaseWidgetPropertyPane { public class WidgetPropertyPane extends FormDockView implements BaseWidgetPropertyPane {
private static final String PARA = "para"; private static final int PADDING = 10;
private static final String BODY = "body"; private static final int PADDING_M = 12;
private FormWidgetCardPane formWidgetCardPane; // 控件的属性表 private FormWidgetCardPane formWidgetCardPane; // 控件的属性表
private EventPropertyTable eventTable; // 控件的事件表 private EventPropertyTable eventTable; // 控件的事件表
private List<AbstractPropertyTable> widgetPropertyTables; // 这个变量应该是保存控件拓展的属性tab private List<AbstractPropertyTable> widgetPropertyTables; // 这个变量应该是保存控件拓展的属性tab
private List<MobileWidgetDefinePane> mobileExtraPropertyPanes; // 保存9.0设计器下移动端拓展的属性tab,舍弃JTable private List<MobileWidgetDefinePane> mobileExtraPropertyPanes; // 保存9.0设计器下移动端拓展的属性tab,舍弃JTable
private FormDesigner designer; // 当前designer private FormDesigner designer; // 当前designer
private UIScrollPane psp; // 用来装载属性表table的容器 private UIScrollPane psp; // 用来装载属性表table的容器
private UIScrollPane esp; //用来装载事件table的容器
private JPanel wsp; // 装载移动端tab的容器,包括移动端属性表和控件拓展的移动端属性表 private JPanel wsp; // 装载移动端tab的容器,包括移动端属性表和控件拓展的移动端属性表
private MobileParaWidgetTable mobileParaWidgetTable; // 参数面板的移动端属性tab(和body的移动端属性tab区别是没有标签名column)
private MobileWidgetTable mobileWidgetTable; // body的移动端属性tab
private UIScrollPane downPanel; // 这个滚动容器是用于装载centerPane的
private JPanel centerPane; // 此centerPane采用的是cardLayout布局,装载着mobileWidgetTable和mobileBodyWidgetTable
private CardLayout cardLayout; // 卡片布局,选中参数面板时显示mobileWidgetTable,选中body时显示mobileBodyWidgetTable
private JTableHeader header;//把表头单独get出来作为一个组件
private UIHeadGroup tabsHeaderIconPane; private UIHeadGroup tabsHeaderIconPane;
private XComponent lastAffectedCreator; private XComponent lastAffectedCreator;
@ -122,6 +112,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope
if (mobileExtraPropertyPanes != null) { if (mobileExtraPropertyPanes != null) {
for (MobileWidgetDefinePane extraPane : mobileExtraPropertyPanes) { for (MobileWidgetDefinePane extraPane : mobileExtraPropertyPanes) {
extraPane.initPropertyGroups(designer); extraPane.initPropertyGroups(designer);
extraPane.populate(designer);
} }
} }
if (widgetPropertyTables != null) { if (widgetPropertyTables != null) {
@ -156,33 +147,10 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope
//加上表头后,这里不再使用borderLayout布局,而采用BoxLayout布局 //加上表头后,这里不再使用borderLayout布局,而采用BoxLayout布局
wsp = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); wsp = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();
wsp.setBorder(null); wsp.setBorder(null);
mobileParaWidgetTable = new MobileParaWidgetTable(designer);
mobileWidgetTable = new MobileWidgetTable(designer);
designer.addDesignerEditListener(new MobileWidgetDesignerAdapter()); designer.addDesignerEditListener(new MobileWidgetDesignerAdapter());
centerPane = FRGUIPaneFactory.createCardLayout_S_Pane();
cardLayout = (CardLayout) centerPane.getLayout();
centerPane.add(mobileParaWidgetTable, PARA);
// 采用卡片布局的容器必须指定卡片名字,如果没有卡片名字
// 就会出现:Exception in thread "main" java.lang.IllegalArgumentException:
// cannot add to layout: constraint must be a string
// 第二个参数代表卡片的名字。后来show方法调用时通过名字找到要显示的卡片
centerPane.add(mobileWidgetTable, BODY); //这两句代码,是把JTable放到一个JPanel中去了,表头不会显示,
//只有放到JScrollPanel中去表头才能正常显示,这就是MobileWidgetTable中定义了表头却没有显示的原因!
//解决方案:MobileWidgetTable实在无法直接放到JScrollPanel中去的时候,应该把表头get出来单独作为一个组件显示
if (hasSelectParaPane(designer)) {
cardLayout.show(centerPane, PARA);
header = mobileParaWidgetTable.getTableHeader();
} else {
cardLayout.show(centerPane, BODY);
header = mobileWidgetTable.getTableHeader();
}
downPanel = new UIScrollPane(centerPane);
downPanel.setBorder(new LineBorder(Color.GRAY));
//获取拓展移动端属性tab //获取拓展移动端属性tab
WidgetPropertyUIProvider[] widgetAttrProviders = getExtraPropertyUIProviders(); WidgetPropertyUIProvider[] widgetAttrProviders = getExtraPropertyUIProviders();
addWidgetAttr(widgetAttrProviders); addWidgetAttr(widgetAttrProviders);
} }
@ -217,13 +185,13 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope
* @param widgetAttrProviders 拓展的tab * @param widgetAttrProviders 拓展的tab
*/ */
private void addWidgetAttr(WidgetPropertyUIProvider[] widgetAttrProviders) { private void addWidgetAttr(WidgetPropertyUIProvider[] widgetAttrProviders) {
if (widgetAttrProviders.length == 0) { // 判断有没有拓展的tab,没有就使用原来的 if (widgetAttrProviders.length == 0) { // 判断有没有拓展的tab,提示"无可用配置项"
wsp.add(header); wsp.add(getUnavailablePane());
wsp.add(downPanel);
} else { } else {
for (WidgetPropertyUIProvider widgetAttrProvider : widgetAttrProviders) { for (WidgetPropertyUIProvider widgetAttrProvider : widgetAttrProviders) {
MobileWidgetDefinePane extraPane = (MobileWidgetDefinePane) widgetAttrProvider.createWidgetAttrPane(); MobileWidgetDefinePane extraPane = (MobileWidgetDefinePane) widgetAttrProvider.createWidgetAttrPane();
if (extraPane != null) { if (extraPane != null) {
extraPane.setBorder(BorderFactory.createEmptyBorder(PADDING, PADDING, PADDING, PADDING_M));
mobileExtraPropertyPanes.add(extraPane); mobileExtraPropertyPanes.add(extraPane);
wsp.add(extraPane); wsp.add(extraPane);
} }
@ -232,29 +200,20 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope
widgetPropertyTables.add(propertyTable); widgetPropertyTables.add(propertyTable);
designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(formWidgetCardPane)); designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(formWidgetCardPane));
UIScrollPane uiScrollPane = new UIScrollPane(getExtraBodyTable(propertyTable)); UIScrollPane uiScrollPane = new UIScrollPane(propertyTable);
wsp.add(uiScrollPane); wsp.add(uiScrollPane);
} }
} }
} }
} }
/** // "无可用配置项"面板
* 如果是body的拓展属性表那么要额外加上一张控件顺序表 private JPanel getUnavailablePane() {
* JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane();
* @return UILabel label = new UILabel(Inter.getLocText("FR-Designer_No_Settings_Available"));
*/ label.setHorizontalAlignment(SwingConstants.CENTER);
private Component getExtraBodyTable(AbstractPropertyTable abstractPropertyTable) { panel.add(label);
Widget selection = designer.getSelectionModel().getSelection().getSelectedCreator().toData(); return panel;
if ("body".equals(selection.getWidgetName())) {
JPanel jPanel = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();
jPanel.add(abstractPropertyTable);
MobileWidgetTable mobileWidgetTable = new MobileWidgetTable(designer);
jPanel.add(mobileWidgetTable.getTableHeader());
jPanel.add(mobileWidgetTable);
return jPanel;
}
return abstractPropertyTable;
} }
private void initTabPane() { private void initTabPane() {

25
designer-form/src/com/fr/design/mainframe/actions/FormMobileAttrAction.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe.actions; package com.fr.design.mainframe.actions;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.iofileattr.MobileOnlyTemplateAttrMark;
import com.fr.design.actions.JTemplateAction; import com.fr.design.actions.JTemplateAction;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
@ -8,7 +9,9 @@ import com.fr.design.form.mobile.FormMobileAttrPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.FormArea; import com.fr.design.mainframe.FormArea;
import com.fr.design.mainframe.JForm; import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.file.FILE;
import com.fr.form.main.Form; import com.fr.form.main.Form;
import com.fr.form.main.mobile.FormMobileAttr; import com.fr.form.main.mobile.FormMobileAttr;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -52,15 +55,27 @@ public class FormMobileAttrAction extends JTemplateAction<JForm> {
@Override @Override
public void doOk() { public void doOk() {
FormMobileAttr formMobileAttr = mobileAttrPane.updateBean(); FormMobileAttr formMobileAttr = mobileAttrPane.updateBean();
formTpl.setFormMobileAttr(formMobileAttr); if (formMobileAttr.isMobileOnly() && jf.getTarget().getAttrMark(MobileOnlyTemplateAttrMark.XML_TAG) == null) {
((FormArea)jf.getFormDesign().getParent()).onMobileAttrModified(); // 如果是老模板,选择手机专属之后需要另存为
jf.fireTargetModified(); FILE editingFILE = jf.getEditingFILE();
if (formMobileAttr.isMobileOnly()) { if (editingFILE != null && editingFILE.exists()) {
String fileName = editingFILE.getName().substring(0, editingFILE.getName().length() - jf.suffix().length()) + "_mobile";
if (!jf.saveAsTemplate(true, fileName)) {
return;
}
}
// 放到后面。如果提前 return 了,则仍然处于未设置状态,不要添加
jf.getTarget().addAttrMark(new MobileOnlyTemplateAttrMark());
}
// 记录功能点
FunctionProcessor processor = ExtraClassManager.getInstance().getFunctionProcessor(); FunctionProcessor processor = ExtraClassManager.getInstance().getFunctionProcessor();
if (processor != null) { if (processor != null) {
processor.recordFunction(ReportFunctionProcessor.MOBILE_TEMPLATE_FRM); processor.recordFunction(ReportFunctionProcessor.MOBILE_TEMPLATE_FRM);
} }
} // 设置移动端属性并刷新界面
formTpl.setFormMobileAttr(formMobileAttr); // 会调整 body 的自适应布局,放到最后
((FormArea)jf.getFormDesign().getParent()).onMobileAttrModified();
WidgetPropertyPane.getInstance().refreshDockingView();
} }
}); });
dialog.setVisible(true); dialog.setVisible(true);

10
designer-form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.widget.ui; package com.fr.design.mainframe.widget.ui;
import com.fr.base.BaseUtils;
import com.fr.design.data.DataCreatorUI; import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
@ -16,7 +17,9 @@ import com.fr.design.dialog.BasicScrollPane;
import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.widget.DataModify; import com.fr.design.widget.DataModify;
import com.fr.design.widget.FormWidgetDefinePaneFactoryBase; import com.fr.design.widget.FormWidgetDefinePaneFactoryBase;
@ -34,6 +37,7 @@ import com.fr.stable.StringUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -208,6 +212,12 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
currentEditorDefinePane.setGlobalName(getGlobalName()); currentEditorDefinePane.setGlobalName(getGlobalName());
Widget widget = currentEditorDefinePane.updateBean(); Widget widget = currentEditorDefinePane.updateBean();
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Basic")) && widgetPropertyPane != null) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Basic")) && widgetPropertyPane != null) {
UITextField widgetNameField = widgetPropertyPane.getWidgetNameField();
if (designer.getTarget().isNameExist(widgetNameField.getText()) && !ComparatorUtils.equals(widgetNameField.getText(), widget.getWidgetName())) {
widgetNameField.setText(widget.getWidgetName());
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_Form_Widget_Rename_Failure"), Inter.getLocText("FR-Designer_Joption_News"), JOptionPane.ERROR_MESSAGE, BaseUtils.readIcon("com/fr/design/form/images/joption_failure.png"));
return;
}
widgetPropertyPane.update(widget); widgetPropertyPane.update(widget);
xCreator.resetCreatorName(widget.getWidgetName()); xCreator.resetCreatorName(widget.getWidgetName());
xCreator.resetVisible(widget.isVisible()); xCreator.resetVisible(widget.isVisible());

16
designer-form/src/com/fr/design/parameter/ParameterPropertyPane.java

@ -1,6 +1,7 @@
package com.fr.design.parameter; package com.fr.design.parameter;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.dialog.BasicScrollPane; import com.fr.design.dialog.BasicScrollPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
@ -79,7 +80,7 @@ public class ParameterPropertyPane extends JPanel{
} }
}; };
JPanel scrollPaneWrapperInner = new JPanel(new BorderLayout()); JPanel scrollPaneWrapperInner = new JPanel(new BorderLayout());
scrollPaneWrapperInner.setBorder(BorderFactory.createEmptyBorder(0, PADDING_MIDDLE, PADDING_MIDDLE, PADDING_SMALL)); scrollPaneWrapperInner.setBorder(BorderFactory.createEmptyBorder(PADDING_MIDDLE, PADDING_MIDDLE, PADDING_MIDDLE, PADDING_SMALL));
scrollPaneWrapperInner.add(basicScrollPane, BorderLayout.CENTER); scrollPaneWrapperInner.add(basicScrollPane, BorderLayout.CENTER);
addParaPane = new JPanel(new BorderLayout()); addParaPane = new JPanel(new BorderLayout());
addParaPane.add(scrollPaneWrapperInner, BorderLayout.CENTER); addParaPane.add(scrollPaneWrapperInner, BorderLayout.CENTER);
@ -87,8 +88,8 @@ public class ParameterPropertyPane extends JPanel{
initParameterListener(); initParameterListener();
this.setLayout(new BorderLayout(0, 6)); this.setLayout(new BorderLayout(0, 6));
this.setBorder(BorderFactory.createEmptyBorder(PADDING_MIDDLE, 0, PADDING_MIDDLE, 0)); this.setBorder(BorderFactory.createEmptyBorder(0, 0, PADDING_MIDDLE, 0));
this.add(addParaPane, BorderLayout.CENTER); this.add(addParaPane, BorderLayout.NORTH);
} }
// 显示或隐藏添加参数面板 // 显示或隐藏添加参数面板
@ -113,14 +114,15 @@ public class ParameterPropertyPane extends JPanel{
} }
public void setAddParaPaneVisible(boolean isVisible, JTemplate jt) { public void setAddParaPaneVisible(boolean isVisible, JTemplate jt) {
if (isVisible == addParaPane.isVisible() || formHierarchyTreePaneWrapper == null) { if (formHierarchyTreePaneWrapper == null) {
return; return;
} }
// 表单中,只有添加并选中参数面板时,才显示 // 表单中,只有添加并选中参数面板时,才显示
boolean hideInJForm; boolean hideInJForm;
try { try {
XCreator creator = (XCreator) FormHierarchyTreePane.getInstance().getComponentTree().getSelectionPath().getLastPathComponent();
hideInJForm = jt instanceof JForm && hideInJForm = jt instanceof JForm &&
!(FormHierarchyTreePane.getInstance().getComponentTree().getSelectionPath().getLastPathComponent() instanceof XWParameterLayout); !(creator instanceof XWParameterLayout || creator.getParent() instanceof XWParameterLayout);
} catch (NullPointerException ex) { } catch (NullPointerException ex) {
hideInJForm = true; hideInJForm = true;
} }
@ -129,15 +131,17 @@ public class ParameterPropertyPane extends JPanel{
this.setPreferredSize(null); this.setPreferredSize(null);
} else { } else {
addParaPane.setVisible(false); addParaPane.setVisible(false);
if (formHierarchyTreePaneWrapper.getPreferredSize().height > 0) {
this.setPreferredSize(new Dimension(getWidth(), formHierarchyTreePaneWrapper.getPreferredSize().height + UIConstants.GAP_NORMAL)); this.setPreferredSize(new Dimension(getWidth(), formHierarchyTreePaneWrapper.getPreferredSize().height + UIConstants.GAP_NORMAL));
} }
} }
}
private void setEditor(FormDesigner editor) { private void setEditor(FormDesigner editor) {
if (formHierarchyTreePaneWrapper == null) { if (formHierarchyTreePaneWrapper == null) {
formHierarchyTreePaneWrapper = new JPanel(new BorderLayout()); formHierarchyTreePaneWrapper = new JPanel(new BorderLayout());
formHierarchyTreePaneWrapper.setBorder(BorderFactory.createEmptyBorder(0, PADDING_MIDDLE, 0, 0)); formHierarchyTreePaneWrapper.setBorder(BorderFactory.createEmptyBorder(0, PADDING_MIDDLE, 0, 0));
this.add(formHierarchyTreePaneWrapper, BorderLayout.SOUTH); this.add(formHierarchyTreePaneWrapper, BorderLayout.CENTER);
} }
formHierarchyTreePaneWrapper.remove(FormHierarchyTreePane.getInstance()); formHierarchyTreePaneWrapper.remove(FormHierarchyTreePane.getInstance());
formHierarchyTreePaneWrapper.add(FormHierarchyTreePane.getInstance(editor), BorderLayout.CENTER); formHierarchyTreePaneWrapper.add(FormHierarchyTreePane.getInstance(editor), BorderLayout.CENTER);

49
designer-form/src/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java

@ -18,9 +18,14 @@ import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.ElementCaseEditor;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.BorderFactory;
import java.awt.*; import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Component;
/** /**
* 报表块-移动端属性面板 * 报表块-移动端属性面板
@ -28,6 +33,7 @@ import java.awt.*;
* Created by fanglei on 2017/8/8. * Created by fanglei on 2017/8/8.
*/ */
public class ElementCaseDefinePane extends MobileWidgetDefinePane{ public class ElementCaseDefinePane extends MobileWidgetDefinePane{
private static final double MAX_HEIGHT_LIMIT = 0.8;
private static final Item[] ITEMS = { private static final Item[] ITEMS = {
new Item(MobileFitAttrState.HORIZONTAL.description(), MobileFitAttrState.HORIZONTAL), new Item(MobileFitAttrState.HORIZONTAL.description(), MobileFitAttrState.HORIZONTAL),
new Item(MobileFitAttrState.VERTICAL.description(), MobileFitAttrState.VERTICAL), new Item(MobileFitAttrState.VERTICAL.description(), MobileFitAttrState.VERTICAL),
@ -48,25 +54,6 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane{
this.xCreator = xCreator; this.xCreator = xCreator;
} }
@Override
protected void initContentPane() {}
@Override
protected JPanel createContentPane() {
return null;
}
@Override
public String getIconPath() {
return "";
}
@Override
public String title4PopupWindow() {
return "ElementCase";
}
@Override @Override
public void initPropertyGroups(Object source) { public void initPropertyGroups(Object source) {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
@ -75,7 +62,25 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane{
this.vComboBox = new UIComboBox(ITEMS); this.vComboBox = new UIComboBox(ITEMS);
this.heightRestrictCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Mobile-Height-Limit")); this.heightRestrictCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Mobile-Height-Limit"));
this.maxHeightLabel = new UILabel(Inter.getLocText("FR-Designer_Mobile-Height-Percent"), SwingConstants.LEFT); this.maxHeightLabel = new UILabel(Inter.getLocText("FR-Designer_Mobile-Height-Percent"), SwingConstants.LEFT);
this.maxHeightSpinner = new UISpinner(0, 1, 0.01, 0.75); this.maxHeightSpinner = new UISpinner(0, MAX_HEIGHT_LIMIT, 0.01, 0.75) {
public void setValue(double value) {
String warningText = StringUtils.EMPTY;
if (value > MAX_HEIGHT_LIMIT) {
warningText = Inter.getLocText("FR-Designer_Mobile-Warning");
} else if (value < 0) {
// 弹窗提示
warningText = Inter.getLocText("FR-Designer_Max_Height_Cannot_Be_Negative");
}
if (StringUtils.isNotEmpty(warningText)) {
// 弹窗提示
JOptionPane.showMessageDialog(null,
warningText,
Inter.getLocText("FR-Designer_Tooltips"),
JOptionPane.PLAIN_MESSAGE);
}
super.setValue(value);
}
};
maxHeightSpinner.setVisible(false); maxHeightSpinner.setVisible(false);
maxHeightLabel.setVisible(false); maxHeightLabel.setVisible(false);

12
designer-form/src/com/fr/design/widget/ui/designer/mobile/MobileWidgetDefinePane.java

@ -3,6 +3,8 @@ package com.fr.design.widget.ui.designer.mobile;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import javax.swing.*;
/** /**
* 所有移动端需要拓展的属性面板均继承此类 * 所有移动端需要拓展的属性面板均继承此类
* *
@ -23,4 +25,14 @@ public abstract class MobileWidgetDefinePane extends AbstractAttrNoScrollPane{
* 从属性面板把数据传到后台 * 从属性面板把数据传到后台
*/ */
public abstract void update(); public abstract void update();
// 暂不需要此方法
@Override
protected void initContentPane() {}
// 暂不需要此方法
@Override
protected JPanel createContentPane() {
return new JPanel();
}
} }

2
designer-realize/src/com/fr/design/actions/edit/EditFloatElementNameAction.java

@ -39,7 +39,7 @@ public class EditFloatElementNameAction extends FloatSelectionAction {
if (report.getFloatElement(name) == null) { if (report.getFloatElement(name) == null) {
selectedFloatElement.setName(name); selectedFloatElement.setName(name);
} }
reportPane.setSelection(new FloatSelection(name)); ((FloatSelection) reportPane.getSelection()).setFloatName(name);
} }
}); });
nameDialog.setVisible(true); nameDialog.setVisible(true);

75
designer-realize/src/com/fr/design/actions/report/ReportPrintSettingAction.java

@ -0,0 +1,75 @@
package com.fr.design.actions.report;
import com.fr.base.IconManager;
import com.fr.base.print.PrintSettingsAttrMark;
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.main.impl.WorkBook;
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 WorkBook 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;
}
};
}

2
designer-realize/src/com/fr/design/mainframe/ElementCasePaneDelegate.java

@ -79,9 +79,7 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance()); EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance());
return; return;
} }
if (DesignerContext.getDesignerFrame().getSelectedJTemplate() != null) {
CellWidgetPropertyPane.getInstance().populate(ElementCasePaneDelegate.this); CellWidgetPropertyPane.getInstance().populate(ElementCasePaneDelegate.this);
}
CellElementPropertyPane.getInstance().populate(ElementCasePaneDelegate.this); CellElementPropertyPane.getInstance().populate(ElementCasePaneDelegate.this);
QuickEditorRegion.getInstance().populate(getCurrentEditor()); QuickEditorRegion.getInstance().populate(getCurrentEditor());
JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();

7
designer-realize/src/com/fr/design/mainframe/JWorkBook.java

@ -22,6 +22,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.ReportWatermarkAction; import com.fr.design.actions.report.ReportWatermarkAction;
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;
@ -695,6 +696,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 ReportWatermarkAction(this), new ReportWatermarkAction(this),
new NameSeparator(Inter.getLocText("Utils-Current_Sheet")), new NameSeparator(Inter.getLocText("Utils-Current_Sheet")),
}, this.reportComposite.getEditingReportComponent().shortcut4TemplateMenu()); }, this.reportComposite.getEditingReportComponent().shortcut4TemplateMenu());
@ -1027,6 +1029,11 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
return ps; return ps;
} }
@Override
public Parameter[] getJTemplateParameters() {
return this.parameterPane.getAllParameters();
}
/** /**
* 请求单元格区域的焦点 * 请求单元格区域的焦点
*/ */

132
designer-realize/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());
} }

7
designer-realize/src/com/fr/design/mainframe/form/FormElementCasePaneDelegate.java

@ -21,6 +21,7 @@ import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.design.present.ConditionAttributesGroupPane; import com.fr.design.present.ConditionAttributesGroupPane;
import com.fr.form.main.Form; import com.fr.form.main.Form;
import com.fr.grid.Grid;
import com.fr.js.NameJavaScriptGroup; import com.fr.js.NameJavaScriptGroup;
import com.fr.page.ReportSettingsProvider; import com.fr.page.ReportSettingsProvider;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
@ -34,7 +35,11 @@ public class FormElementCasePaneDelegate extends ElementCasePane<FormElementCase
public FormElementCasePaneDelegate(FormElementCase sheet, Form form) { public FormElementCasePaneDelegate(FormElementCase sheet, Form form) {
super(sheet); super(sheet);
this.getGrid().setShowPaginateLine(form.getFormMobileAttr().isMobileOnly());
this.getGrid().setPaginateLineShowType(form.getFormMobileAttr().isMobileOnly()
? Grid.SINGLE_HORIZONTAL_PAGINATE_LINE
: Grid.NO_PAGINATE_LINE);
this.addSelectionChangeListener(new SelectionListener() { this.addSelectionChangeListener(new SelectionListener() {
@Override @Override
public void selectionChanged(SelectionEvent e) { public void selectionChanged(SelectionEvent e) {

4
designer-realize/src/com/fr/design/report/PageSetupPane.java

@ -196,10 +196,12 @@ public class PageSetupPane extends BasicPane {
paperSizePane.add(innerpaperSizePane); paperSizePane.add(innerpaperSizePane);
defaultPane.add(paperSizePane); defaultPane.add(paperSizePane);
predefinedRadioButton = new UIRadioButton(Inter.getLocText("PageSetup-Predefined") + ":"); predefinedRadioButton = new UIRadioButton(Inter.getLocText("PageSetup-Predefined") + ":");
predefinedRadioButton.setMnemonic('P'); predefinedRadioButton.setMnemonic('P');
predefinedRadioButton.addActionListener(previewListener); predefinedRadioButton.addActionListener(previewListener);
customRadioButton = new UIRadioButton(Inter.getLocText("Custom") + ":"); customRadioButton = new UIRadioButton(Inter.getLocText("Custom") + ":");
customRadioButton.setMnemonic('C'); customRadioButton.setMnemonic('C');
customRadioButton.addActionListener(previewListener); customRadioButton.addActionListener(previewListener);
@ -234,7 +236,6 @@ public class PageSetupPane extends BasicPane {
predefinedComboBox.addItem(tmpPaperSizeNameArray[1]); predefinedComboBox.addItem(tmpPaperSizeNameArray[1]);
} }
// tow radio buttons. // tow radio buttons.
JPanel radioButtonPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel radioButtonPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
innerpaperSizePane.add(radioButtonPane); innerpaperSizePane.add(radioButtonPane);
@ -659,7 +660,6 @@ public class PageSetupPane extends BasicPane {
sbuf.append(']'); sbuf.append(']');
} }
/** /**
* Paper size item listener. * Paper size item listener.
*/ */

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

@ -4,6 +4,7 @@
package com.fr.design.webattr; package com.fr.design.webattr;
import com.fr.base.ConfigManager; import com.fr.base.ConfigManager;
import com.fr.base.print.PrintSettingsAttrMark;
import com.fr.config.ServerPreferenceConfig; import com.fr.config.ServerPreferenceConfig;
import com.fr.design.gui.frpane.LoadingBasicPane; import com.fr.design.gui.frpane.LoadingBasicPane;
import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.frpane.UITabbedPane;
@ -11,7 +12,9 @@ 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.report.core.ReportUtils;
import com.fr.web.attr.ReportWebAttr; import com.fr.web.attr.ReportWebAttr;
import javax.swing.*; import javax.swing.*;
@ -31,6 +34,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;
@ -38,6 +42,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) {
@ -65,6 +71,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
@ -84,9 +91,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(reportServerPreferenceConfig.getErrorTemplate()); this.errorTemplatePane.populateBean(reportServerPreferenceConfig.getErrorTemplate());
} }
@ -99,11 +107,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.getProviderInstance()).getPrintAttr().setPrintSettings(printSettings);
reportServerPreferenceConfig.setErrorTemplate(this.errorTemplatePane.updateBean()); reportServerPreferenceConfig.setErrorTemplate(this.errorTemplatePane.updateBean());
} }
} }

71
designer-realize/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,26 +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, WRITEOFFLINEHTML, CUSTOM_BUTTON, WRITESTASH, WRITESTASHCLEAR, IMPORTEXCELDATA_CUSTOMIZED}; APPENDCOLUMNROW, DELETECOLUMNROW, SETPRINTEROFFSET, WRITEOFFLINEHTML, CUSTOM_BUTTON, WRITESTASH, WRITESTASHCLEAR, IMPORTEXCELDATA_CUSTOMIZED,
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};
} }
// 查询 // 查询
@ -113,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"),
@ -148,5 +186,16 @@ public class ReportWebWidgetConstants {
// 数据清空 // 数据清空
public static final WidgetOption WRITESTASHCLEAR = WidgetOptionFactory public static final WidgetOption WRITESTASHCLEAR = WidgetOptionFactory
.createByWidgetClass(Inter.getLocText("FR-Engine-Write_Clear"), BaseUtils.readIcon("/com/fr/web/images/edit/clearstash.png"), ClearStashedButton.class); .createByWidgetClass(Inter.getLocText("FR-Engine-Write_Clear"), BaseUtils.readIcon("/com/fr/web/images/edit/clearstash.png"), ClearStashedButton.class);
//Excel导入
public static final WidgetOption IMPORTEXCEL= WidgetOptionFactory.createByWidgetClass(Inter.getLocText("FR-Engine_Excel_Import_Repeat"),
BaseUtils.readIcon("/com/fr/web/images/excel.png"), ExcelImport.class);
//Excel导入_覆盖
public static final WidgetOption IMPORTEXCEL_COVER= WidgetOptionFactory.createByWidgetClass(Inter.getLocText("FR-Engine_Excel_Import_Cover"),
BaseUtils.readIcon("/com/fr/web/images/excel.png"), ImExcelCover.class);
//Excel导入_清空
public static final WidgetOption IMPORTEXCEL_CLEAN= WidgetOptionFactory.createByWidgetClass(Inter.getLocText("FR-Engine_Excel_Import_Clean"),
BaseUtils.readIcon("/com/fr/web/images/excel.png"), ImExcelClean.class);
//Excel导入_增量
public static final WidgetOption IMPORTEXCEL_APPEND= WidgetOptionFactory.createByWidgetClass(Inter.getLocText("FR-Engine_Excel_Import_Append"),
BaseUtils.readIcon("/com/fr/web/images/excel.png"), ImExcelAppend.class);
} }

2
designer-realize/src/com/fr/design/webattr/ToolBarDragPane.java

@ -34,7 +34,7 @@ import java.awt.image.ImageObserver;
public class ToolBarDragPane extends WidgetToolBarPane { public class ToolBarDragPane extends WidgetToolBarPane {
private static final int COLUMN = 4; private static final int COLUMN = 4;
private int row = 6; private int row = 7;
private DefaultTableModel toolbarButtonTableModel; private DefaultTableModel toolbarButtonTableModel;
private JTable layoutTable; private JTable layoutTable;
private UICheckBox isUseToolBarCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Use_ToolBar") + ":"); // 是否使用工具栏 private UICheckBox isUseToolBarCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Use_ToolBar") + ":"); // 是否使用工具栏

365
designer-realize/src/com/fr/design/webattr/printsettings/NativePrintSettingPane.java

@ -0,0 +1,365 @@
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 com.fr.stable.StringUtils;
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.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.HashSet;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 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;
private JPanel centerPane;
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);
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());
isShowDialogCheck.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
checkEnabled();
}
});
specifiedAreaField.addFocusListener(new FocusAdapter() {
String lastValidText = StringUtils.EMPTY;
@Override
public void focusGained(FocusEvent e) {
lastValidText = specifiedAreaField.getText();
}
@Override
public void focusLost(FocusEvent e) {
String text = specifiedAreaField.getText();
Pattern r = Pattern.compile("^(\\d+-)?\\d+$");
Matcher m = r.matcher(text);
if (!m.matches()) {
specifiedAreaField.setText(lastValidText);
}
super.focusLost(e);
}
});
}
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) {
@Override
public void setEnabled(boolean enabled) {
// 如果未选中"指定页",此输入框始终不可用
if (enabled && !customPageRadioButton.isSelected()) {
return;
}
super.setEnabled(enabled);
}
};
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());
}
// 刷新面板可用状态
public void checkEnabled() {
GUICoreUtils.setEnabled(centerPane, !isShowDialogCheck.isSelected());
}
}

103
designer-realize/src/com/fr/design/webattr/printsettings/NoClientPrintSettingPane.java

@ -0,0 +1,103 @@
package com.fr.design.webattr.printsettings;
import com.fr.base.print.NoClientPrintAttr;
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 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/5.
*/
public class NoClientPrintSettingPane extends JPanel {
private UICheckBox setMarginWhenPrintCheck;
private UICheckBox inheritPageMarginSettingCheck; // 继承页面边距设置
private PageMarginSettingPane pageMarginSettingPane;
private JPanel centerPane;
public NoClientPrintSettingPane() {
initComponents();
initListeners();
}
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);
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);
}
private void initListeners() {
setMarginWhenPrintCheck.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
checkEnabled();
}
});
}
// 返回包含一个标签的 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());
}
// 刷新面板可用状态
public void checkEnabled() {
GUICoreUtils.setEnabled(centerPane, !setMarginWhenPrintCheck.isSelected());
}
}

79
designer-realize/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;
}
}

112
designer-realize/src/com/fr/design/webattr/printsettings/PrintSettingPane.java

@ -0,0 +1,112 @@
package com.fr.design.webattr.printsettings;
import com.fr.base.print.PrintSettingsAttrMark;
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 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());
}
}
});
}
// 刷新面板可用状态
public void checkEnabled() {
noClientPrintSettingPane.checkEnabled();
nativePrintSettingPane.checkEnabled();
}
@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);
noClientPrintSettingPane.update(printSettings.getNoClientPrintAttr());
nativePrintSettingPane.update(printSettings.getNativePrintAttr());
return printSettings;
}
}

101
designer-realize/src/com/fr/design/webattr/printsettings/ReportPrintSettingPane.java

@ -0,0 +1,101 @@
package com.fr.design.webattr.printsettings;
import com.fr.base.print.PrintSettingsAttrMark;
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.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) {
setSettingPaneEnabled(true);
} else {
populateServerSettings();
setSettingPaneEnabled(false);
}
}
}
};
private void setSettingPaneEnabled(boolean enabled) {
// GUICoreUtils.setEnabled 会遍历所有 Component。所以要先设置外层,如果是生效的,再设置内层
GUICoreUtils.setEnabled(printSettingPane, enabled);
if (enabled) {
printSettingPane.checkEnabled();
}
}
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");
}
}

2
designer-realize/src/com/fr/design/widget/WidgetEventPane.java

@ -91,7 +91,7 @@ public class WidgetEventPane extends ObjectUIControlPane {
@Override @Override
protected DBManipulationPane createDBManipulationPane() { protected DBManipulationPane createDBManipulationPane() {
if(epane == null) { if(epane == null && DesignerContext.getDesignerFrame().getSelectedJTemplate() != null) {
return autoCreateDBManipulationInWidgetEventPane(); return autoCreateDBManipulationInWidgetEventPane();
} }

36
designer-realize/src/com/fr/grid/Grid.java

@ -61,6 +61,9 @@ public class Grid extends BaseGridComponent {
/** /**
* If editing, the <code>Component</code> that is handling the editing. * If editing, the <code>Component</code> that is handling the editing.
*/ */
public static final int NO_PAGINATE_LINE = 0; // 不显示分页线
public static final int MULTIPLE_PAGINATE_LINE = 1; // 绘制多条分页线
public static final int SINGLE_HORIZONTAL_PAGINATE_LINE = 2; // 仅绘制一条水平分页线
private static final int VERTICAL_EXTENT_INITIAL_VALUE = 50; private static final int VERTICAL_EXTENT_INITIAL_VALUE = 50;
private static final int HORIZONTAL_EXTENT_INITIAL_VALUE = 40; private static final int HORIZONTAL_EXTENT_INITIAL_VALUE = 40;
transient protected Component editorComponent; transient protected Component editorComponent;
@ -70,7 +73,7 @@ public class Grid extends BaseGridComponent {
private boolean showGridLine = true; private boolean showGridLine = true;
private Color gridLineColor = UIConstants.RULER_LINE_COLOR; // line color. private Color gridLineColor = UIConstants.RULER_LINE_COLOR; // line color.
private boolean isShowPaginateLine = true; private int paginateLineShowType = MULTIPLE_PAGINATE_LINE; // 分页线类型
private Color paginationLineColor = Color.RED; // line color of paper private Color paginationLineColor = Color.RED; // line color of paper
private boolean isShowVerticalFrozenLine = true; private boolean isShowVerticalFrozenLine = true;
@ -216,25 +219,6 @@ public class Grid extends BaseGridComponent {
this.getElementCasePane().repaint(); this.getElementCasePane().repaint();
} }
/**
* 是否显示分页线
*
* @return 是否显示分页线
* @date 2014-12-21-下午6:31:45
*/
public boolean isShowPaginateLine() {
return isShowPaginateLine;
}
/**
* Sets to show pagination line.
*/
public void setShowPaginateLine(boolean showPaginateLine) {
this.isShowPaginateLine = showPaginateLine;
this.getElementCasePane().repaint();
}
/** /**
* Gets pagination line color. * Gets pagination line color.
*/ */
@ -1456,8 +1440,12 @@ public class Grid extends BaseGridComponent {
this.tooltipLocation.setLocation(x, y); this.tooltipLocation.setLocation(x, y);
} }
// @Override public int getPaginateLineShowType() {
// public void requestFocus() { return paginateLineShowType;
// super.requestFocus(); }
// }
public void setPaginateLineShowType(int paginateLineShowType) {
this.paginateLineShowType = paginateLineShowType;
this.getElementCasePane().repaint();
}
} }

15
designer-realize/src/com/fr/grid/GridUI.java

@ -127,7 +127,7 @@ public class GridUI extends ComponentUI {
// richer;聚合报表设计中,最初的ElementCase还没有加到Report中,所以elementCase.getReport()可能为空 // richer;聚合报表设计中,最初的ElementCase还没有加到Report中,所以elementCase.getReport()可能为空
ReportSettingsProvider reportSettings = getReportSettings(elementCase); ReportSettingsProvider reportSettings = getReportSettings(elementCase);
PaperSettingProvider psetting = reportSettings.getPaperSetting(); PaperSettingProvider psetting = reportSettings.getPaperSetting();
if (grid.isShowPaginateLine()) {// paint paper margin line. if (grid.getPaginateLineShowType() != Grid.NO_PAGINATE_LINE) {// paint paper margin line.
PaperSize paperSize = psetting.getPaperSize(); PaperSize paperSize = psetting.getPaperSize();
Margin margin = psetting.getMargin(); Margin margin = psetting.getMargin();
@ -173,7 +173,7 @@ public class GridUI extends ComponentUI {
private void paintScrollBackground(Graphics2D g2d, Grid grid, Background background, PaperSettingProvider psetting, ReportSettingsProvider reportSettings) { private void paintScrollBackground(Graphics2D g2d, Grid grid, Background background, PaperSettingProvider psetting, ReportSettingsProvider reportSettings) {
boolean isCanDrawImage = grid.isEditable() || isAuthority; boolean isCanDrawImage = grid.isEditable() || isAuthority;
if (isCanDrawImage && (background instanceof ImageFileBackground)) { if (isCanDrawImage && (background instanceof ImageFileBackground)) {
if (!grid.isShowPaginateLine()) { if (grid.getPaginateLineShowType() == Grid.NO_PAGINATE_LINE) {
calculatePaper(psetting, reportSettings); calculatePaper(psetting, reportSettings);
} }
@ -239,12 +239,15 @@ public class GridUI extends ComponentUI {
// 分页线 // 分页线
paginateLineList.clear(); paginateLineList.clear();
boolean isShowVerticalPaginateLine = grid.getPaginateLineShowType() == Grid.MULTIPLE_PAGINATE_LINE;
boolean isShowHorizontalPaginateLine = grid.getPaginateLineShowType() != Grid.NO_PAGINATE_LINE;
new DrawVerticalLineHelper(grid.getVerticalBeginValue(), verticalEndValue, new DrawVerticalLineHelper(grid.getVerticalBeginValue(), verticalEndValue,
grid.isShowGridLine(), grid.isShowPaginateLine(), rowHeightList, paperPaintHeight, grid.isShowGridLine(), isShowVerticalPaginateLine, rowHeightList, paperPaintHeight,
paginateLineList, realWidth, resolution).iterateStart2End(g2d); paginateLineList, realWidth, resolution).iterateStart2End(g2d);
new DrawHorizontalLineHelper(grid.getHorizontalBeginValue(), horizontalEndValue, new DrawHorizontalLineHelper(grid.getHorizontalBeginValue(), horizontalEndValue,
grid.isShowGridLine(), grid.isShowPaginateLine(), columnWidthList, paperPaintWidth, grid.isShowGridLine(), isShowHorizontalPaginateLine, columnWidthList, paperPaintWidth,
paginateLineList, realHeight, resolution).iterateStart2End(g2d); paginateLineList, realHeight, resolution).iterateStart2End(g2d);
} }
@ -609,9 +612,13 @@ public class GridUI extends ComponentUI {
//g2d.setXORMode(Utils.getXORColor(grid.getPaginationLineColor())); //g2d.setXORMode(Utils.getXORColor(grid.getPaginationLineColor()));
GraphHelper.setStroke(g2d, GraphHelper.getStroke(Constants.LINE_DASH_DOT)); GraphHelper.setStroke(g2d, GraphHelper.getStroke(Constants.LINE_DASH_DOT));
if (grid.getPaginateLineShowType() == Grid.SINGLE_HORIZONTAL_PAGINATE_LINE) {
g2d.draw((Shape) paginateLineList.get(0));
} else {
for (int i = 0, len = paginateLineList.size(); i < len; i++) { for (int i = 0, len = paginateLineList.size(); i < len; i++) {
g2d.draw((Shape) paginateLineList.get(i)); g2d.draw((Shape) paginateLineList.get(i));
} }
}
g2d.setPaintMode(); g2d.setPaintMode();
} }

Loading…
Cancel
Save