Browse Source

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

* commit 'ed5c8d9567acc2a45437133aabe1ff8faac27757':
  MOBILE-6262 FR9.0设计器提供手机端设计画布参考尺寸
  REPORT-5945 表单切换到绝对布局时,组件缩放重置为双向自适应
  REPORT-5832 表单自适应切到绝对布局后, 需要清理掉一些绝对布局里没有的属性
  无JIRA任务,修复打开表单,控件树消失问题
  REPORT-4634 组件叠加体验优化=>埋点
  REPORT-5955 [Report]删除悬浮元素后,设计器卡死
  REPORT-6270 & REPORT-6443 参数面板里的相关bug(问题2、3);控件树消失问题
  REPORT-6270 参数面板里的相关bug=>删控件的时候,对应的“以下参数未生成”没有实时显示,要再点一下para才显示
  REPORT-6270 & REPORT-6258 参数面板里的相关bug;tab标签右击时原本的移动功能被覆盖了
  REPORT-6277 & REPORT-6276 绝对布局下设计器界面调整了组件上下位置后,web端预览没有相应的变化;cpt里悬浮元素的位置用快捷键无法使用(暂时隐去快捷键)
master
superman 7 years ago
parent
commit
5eddb0c14b
  1. 2
      designer-base/src/com/fr/design/designer/IntervalConstants.java
  2. 7
      designer-base/src/com/fr/design/dialog/mobile/MobileRadioCheckPane.java
  3. 1
      designer-base/src/com/fr/design/gui/imenu/UIPopupMenu.java
  4. 3
      designer-base/src/com/fr/design/mainframe/EastRegionContainerPane.java
  5. 2
      designer-form/src/com/fr/design/designer/beans/actions/CopyAction.java
  6. 2
      designer-form/src/com/fr/design/designer/beans/actions/CutAction.java
  7. 7
      designer-form/src/com/fr/design/designer/beans/actions/FormDeleteAction.java
  8. 17
      designer-form/src/com/fr/design/designer/beans/actions/FormEditAction.java
  9. 39
      designer-form/src/com/fr/design/designer/beans/actions/FormWidgetEditAction.java
  10. 7
      designer-form/src/com/fr/design/designer/beans/actions/MoveDownAction.java
  11. 7
      designer-form/src/com/fr/design/designer/beans/actions/MoveToBottomAction.java
  12. 7
      designer-form/src/com/fr/design/designer/beans/actions/MoveToTopAction.java
  13. 7
      designer-form/src/com/fr/design/designer/beans/actions/MoveUpAction.java
  14. 2
      designer-form/src/com/fr/design/designer/beans/actions/PasteAction.java
  15. 21
      designer-form/src/com/fr/design/designer/creator/XCreator.java
  16. 16
      designer-form/src/com/fr/design/designer/creator/XLayoutContainer.java
  17. 5
      designer-form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java
  18. 21
      designer-form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java
  19. 6
      designer-form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java
  20. 31
      designer-form/src/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java
  21. 17
      designer-form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java
  22. 5
      designer-form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java
  23. 1
      designer-form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java
  24. 26
      designer-form/src/com/fr/design/form/mobile/FormMobileAttrPane.java
  25. 160
      designer-form/src/com/fr/design/form/mobile/FormMobileTemplateSettingsPane.java
  26. 24
      designer-form/src/com/fr/design/mainframe/EditingMouseListener.java
  27. 44
      designer-form/src/com/fr/design/mainframe/FormArea.java
  28. 21
      designer-form/src/com/fr/design/mainframe/FormDesigner.java
  29. 24
      designer-form/src/com/fr/design/mainframe/FormHierarchyTreePane.java
  30. 44
      designer-form/src/com/fr/design/mainframe/JForm.java
  31. 16
      designer-form/src/com/fr/design/mainframe/actions/FormMobileAttrAction.java
  32. 28
      designer-form/src/com/fr/design/parameter/ParameterPropertyPane.java
  33. 1
      designer-form/src/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java
  34. 1
      designer-form/src/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java
  35. 2
      designer-realize/src/com/fr/design/actions/edit/DeleteAction.java
  36. 2
      designer-realize/src/com/fr/design/actions/edit/order/BringFloatElementForwardAction.java
  37. 2
      designer-realize/src/com/fr/design/actions/edit/order/BringFloatElementToFrontAction.java
  38. 2
      designer-realize/src/com/fr/design/actions/edit/order/SendFloatElementBackwardAction.java
  39. 2
      designer-realize/src/com/fr/design/actions/edit/order/SendFloatElementToBackAction.java
  40. 12
      designer-realize/src/com/fr/design/actions/report/ReportMobileAttrAction.java
  41. 5
      designer-realize/src/com/fr/design/mainframe/form/FormElementCaseDesigner.java
  42. 4
      designer-realize/src/com/fr/design/mainframe/form/FormElementCasePaneDelegate.java
  43. 118
      designer-realize/src/com/fr/design/report/PageSetupPane.java
  44. 9
      designer-realize/src/com/fr/design/report/mobile/ReportMobileAttrPane.java
  45. 102
      designer-realize/src/com/fr/design/report/mobile/ReportMobileTemplateSettingsPane.java
  46. 5
      designer-realize/src/com/fr/grid/GridUI.java
  47. 3
      designer-realize/src/com/fr/grid/selection/FloatSelection.java

2
designer-base/src/com/fr/design/designer/IntervalConstants.java

@ -27,4 +27,6 @@ public class IntervalConstants {
public static final int INTERVAL_W3 = 49;
public static final int INTERVAL_W4 = 22;
}

7
designer-base/src/com/fr/design/dialog/mobile/MobileRadioCheckPane.java

@ -2,14 +2,13 @@ package com.fr.design.dialog.mobile;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.Inter;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.Component;
import java.util.ArrayList;
import java.util.List;

1
designer-base/src/com/fr/design/gui/imenu/UIPopupMenu.java

@ -10,6 +10,7 @@ import com.fr.design.constants.UIConstants;
public class UIPopupMenu extends JPopupMenu{
private static final float REC = 8f;
private boolean onlyText = false;
public static UIPopupMenu EMPTY = new UIPopupMenu();
public UIPopupMenu() {
super();
setBackground(UIConstants.NORMAL_BACKGROUND);

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

@ -499,7 +499,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private boolean isEnabled = true; // 是否可用
private Set<PropertyMode> visibleModes;
private Set<PropertyMode> enableModes;
private static final int MAX_PARA_HEIGHT = 240;
// 完整icon路径为 ICON_BASE_DIR + btnIconName + iconSuffix
private static final String ICON_BASE_DIR = "/com/fr/design/images/buttonicon/propertiestab/";
@ -621,8 +620,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
public void replaceHeaderPane(JComponent pane) {
contentArea.remove(headerPane);
int height = Math.min(pane.getPreferredSize().height, MAX_PARA_HEIGHT);
pane.setPreferredSize(new Dimension(pane.getPreferredSize().width, height));
headerPane = pane;
contentArea.add(headerPane, BorderLayout.NORTH);

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

@ -10,7 +10,7 @@ import java.awt.event.KeyEvent;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
public class CopyAction extends FormEditAction {
public class CopyAction extends FormWidgetEditAction {
public CopyAction(FormDesigner t) {
super(t);

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

@ -11,7 +11,7 @@ import com.fr.design.mainframe.FormDesigner;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
public class CutAction extends FormEditAction {
public class CutAction extends FormWidgetEditAction {
public CutAction(FormDesigner t) {
super(t);

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

@ -17,7 +17,7 @@ import com.fr.design.mainframe.FormSelection;
* @author richer
* @since 6.5.3
*/
public class FormDeleteAction extends FormUndoableAction {
public class FormDeleteAction extends FormWidgetEditAction {
public FormDeleteAction(FormDesigner t) {
super(t);
@ -55,9 +55,4 @@ public class FormDeleteAction extends FormUndoableAction {
creator.deleteRelatedComponent(creator, designer);
return false;
}
@Override
public void update() {
this.setEnabled(true);
}
}

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

@ -1,17 +0,0 @@
package com.fr.design.designer.beans.actions;
import com.fr.design.actions.TemplateComponentAction;
import com.fr.design.mainframe.FormDesigner;
public abstract class FormEditAction extends TemplateComponentAction<FormDesigner> {
protected FormEditAction(FormDesigner t) {
super(t);
}
@Override
public void update() {
this.setEnabled(true);
}
}

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

@ -0,0 +1,39 @@
package com.fr.design.designer.beans.actions;
import com.fr.design.actions.TemplateComponentAction;
import com.fr.design.mainframe.FormDesigner;
import com.fr.plugin.ExtraClassManager;
import com.fr.stable.ReportFunctionProcessor;
import com.fr.stable.fun.FunctionProcessor;
import javax.swing.JButton;
import java.awt.event.ActionEvent;
public abstract class FormWidgetEditAction extends TemplateComponentAction<FormDesigner> {
protected FormWidgetEditAction(FormDesigner t) {
super(t);
}
@Override
public void update() {
this.setEnabled(true);
}
@Override
public void actionPerformed(ActionEvent evt) {
super.actionPerformed(evt);
// 记录功能点
FunctionProcessor processor = ExtraClassManager.getInstance().getFunctionProcessor();
if (processor != null) {
FunctionProcessor functionProcessor;
if (evt.getSource() instanceof JButton) {
functionProcessor = ReportFunctionProcessor.FORM_WIDGET_EDIT_TOOLBAR;
} else {
functionProcessor = ReportFunctionProcessor.FORM_WIDGET_EDIT_POPUPMENU;
}
processor.recordFunction(functionProcessor);
}
}
}

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

@ -3,6 +3,7 @@ package com.fr.design.designer.beans.actions;
import com.fr.base.BaseUtils;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormSelection;
import com.fr.general.Inter;
@ -19,7 +20,7 @@ import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_M
* Created by plough on 2017/12/4.
*/
public class MoveDownAction extends FormEditAction {
public class MoveDownAction extends FormWidgetEditAction {
public MoveDownAction(FormDesigner t) {
super(t);
@ -37,13 +38,13 @@ public class MoveDownAction extends FormEditAction {
}
FormSelection selection = designer.getSelectionModel().getSelection();
XCreator creator = selection.getSelectedCreator();
Container container = creator.getParent();
XLayoutContainer container = (XLayoutContainer) creator.getParent();
int targetIndex = container.getComponentZOrder(creator) + 1;
if (targetIndex >= container.getComponentCount()) {
return false;
}
container.setComponentZOrder(creator, targetIndex);
designer.getEditListenerTable().fireCreatorModified(creator, DesignerEvent.CREATOR_DELETED);
designer.getEditListenerTable().fireCreatorModified(creator, DesignerEvent.CREATOR_SELECTED);
return true;
}

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

@ -3,6 +3,7 @@ package com.fr.design.designer.beans.actions;
import com.fr.base.BaseUtils;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormSelection;
import com.fr.general.Inter;
@ -19,7 +20,7 @@ import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_M
* Created by plough on 2017/12/4.
*/
public class MoveToBottomAction extends FormEditAction {
public class MoveToBottomAction extends FormWidgetEditAction {
public MoveToBottomAction(FormDesigner t) {
super(t);
@ -37,13 +38,13 @@ public class MoveToBottomAction extends FormEditAction {
}
FormSelection selection = designer.getSelectionModel().getSelection();
XCreator creator = selection.getSelectedCreator();
Container container = creator.getParent();
XLayoutContainer container = (XLayoutContainer) creator.getParent();
int targetIndex = container.getComponentCount() - 1;
if (container.getComponentZOrder(creator) >= targetIndex) {
return false;
}
container.setComponentZOrder(creator, targetIndex);
designer.getEditListenerTable().fireCreatorModified(creator, DesignerEvent.CREATOR_DELETED);
designer.getEditListenerTable().fireCreatorModified(creator, DesignerEvent.CREATOR_SELECTED);
return true;
}

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

@ -3,6 +3,7 @@ package com.fr.design.designer.beans.actions;
import com.fr.base.BaseUtils;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormSelection;
import com.fr.general.Inter;
@ -19,7 +20,7 @@ import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_M
* Created by plough on 2017/12/4.
*/
public class MoveToTopAction extends FormEditAction {
public class MoveToTopAction extends FormWidgetEditAction {
public MoveToTopAction(FormDesigner t) {
super(t);
@ -37,12 +38,12 @@ public class MoveToTopAction extends FormEditAction {
}
FormSelection selection = designer.getSelectionModel().getSelection();
XCreator creator = selection.getSelectedCreator();
Container container = creator.getParent();
XLayoutContainer container = (XLayoutContainer) creator.getParent();
if (container.getComponentZOrder(creator) == 0) {
return false;
}
container.setComponentZOrder(creator, 0);
designer.getEditListenerTable().fireCreatorModified(creator, DesignerEvent.CREATOR_DELETED);
designer.getEditListenerTable().fireCreatorModified(creator, DesignerEvent.CREATOR_SELECTED);
return true;
}

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

@ -3,6 +3,7 @@ package com.fr.design.designer.beans.actions;
import com.fr.base.BaseUtils;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormSelection;
import com.fr.general.Inter;
@ -18,7 +19,7 @@ import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_M
* Created by plough on 2017/12/4.
*/
public class MoveUpAction extends FormEditAction {
public class MoveUpAction extends FormWidgetEditAction {
public MoveUpAction(FormDesigner t) {
super(t);
@ -36,13 +37,13 @@ public class MoveUpAction extends FormEditAction {
}
FormSelection selection = designer.getSelectionModel().getSelection();
XCreator creator = selection.getSelectedCreator();
Container container = creator.getParent();
XLayoutContainer container = (XLayoutContainer) creator.getParent();
int targetIndex = container.getComponentZOrder(creator) - 1;
if (targetIndex < 0) {
return false;
}
container.setComponentZOrder(creator, targetIndex);
designer.getEditListenerTable().fireCreatorModified(creator, DesignerEvent.CREATOR_DELETED);
designer.getEditListenerTable().fireCreatorModified(creator, DesignerEvent.CREATOR_SELECTED);
return true;
}

2
designer-form/src/com/fr/design/designer/beans/actions/PasteAction.java

@ -11,7 +11,7 @@ import com.fr.design.mainframe.FormDesigner;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
public class PasteAction extends FormEditAction {
public class PasteAction extends FormWidgetEditAction {
public PasteAction(FormDesigner t) {
super(t);

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

@ -12,16 +12,27 @@ import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.*;
import com.fr.design.mainframe.AuthorityPropertyPane;
import com.fr.design.mainframe.BaseJForm;
import com.fr.design.mainframe.EditingMouseListener;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.NoSupportAuthorityEdit;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WTitleLayout;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.border.Border;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.beans.IntrospectionException;
import java.util.ArrayList;
@ -671,9 +682,9 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
* 创建右击弹出菜单
*
*/
public JPopupMenu createPopupMenu(FormDesigner formDesigner) {
public UIPopupMenu createPopupMenu(FormDesigner formDesigner) {
UpdateAction[] actions = formDesigner.getActions();
JPopupMenu popup = new UIPopupMenu();
UIPopupMenu popup = new UIPopupMenu();
for (int i = 0; i < actions.length; i++) {
if (i == SHORTS_SEPARATOR_POS) {
popup.addSeparator();

16
designer-form/src/com/fr/design/designer/creator/XLayoutContainer.java

@ -126,6 +126,14 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
return this;
}
public void setComponentZOrder(XCreator creator, int targetIndex) {
super.setComponentZOrder(creator, targetIndex); // 设计器界面上更改
// 以下是数据层更改,会反映到 web 端
WLayout layout = this.toData();
String widgetName = creator.toData().getWidgetName();
layout.setWidgetIndex(layout.getWidget(widgetName), targetIndex);
}
/**
* 当前组件zorder位置替换新的控件
*
@ -552,4 +560,12 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
return false;
}
/**
* 内部组件是否支持叠加顺序的调整
* return boolean
*/
public boolean supportInnerOrderChangeActions() {
return false;
}
}

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

@ -520,4 +520,9 @@ public class XWAbsoluteLayout extends XLayoutContainer {
widget.setBounds(xCreator.getBounds());
}
}
@Override
public boolean supportInnerOrderChangeActions() {
return true;
}
}

21
designer-form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java

@ -1,13 +1,5 @@
package com.fr.design.designer.creator.cardlayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.MouseEvent;
import javax.swing.Icon;
import com.fr.base.BaseUtils;
import com.fr.base.background.ColorBackground;
import com.fr.design.designer.beans.AdapterBus;
@ -15,6 +7,7 @@ import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.designer.creator.XButton;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.EditingMouseListener;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormHierarchyTreePane;
@ -25,6 +18,13 @@ import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import javax.swing.Icon;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.MouseEvent;
public class XCardAddButton extends XButton{
private XWCardTagLayout tagLayout;
@ -112,6 +112,11 @@ public class XCardAddButton extends XButton{
tagLayout.setTabsAndAdjust();
LayoutUtils.layoutRootContainer(designer.getRootComponent());
}
@Override
public UIPopupMenu createPopupMenu(FormDesigner formDesigner) {
return UIPopupMenu.EMPTY; // 不要菜单
}
private void initRelateLayout(){
XWCardTitleLayout titleLayout = (XWCardTitleLayout)this.getBackupParent();

6
designer-form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java

@ -13,6 +13,7 @@ import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.EditingMouseListener;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormHierarchyTreePane;
@ -213,6 +214,11 @@ public class XCardSwitchButton extends XButton {
GUICoreUtils.showPopupMenu(jPopupMenu, editingMouseListener.getDesigner(), e.getX(), e.getY());
}
@Override
public UIPopupMenu createPopupMenu(FormDesigner formDesigner) {
return UIPopupMenu.EMPTY; // 自己有一个showPopupMenu,不需要使用通用的弹出菜单
}
//删除card,同时修改其他switchbutton和tabfit的index
private void deleteCard(XCardSwitchButton button,int index){
String titleName = button.getContentLabel().getText();

31
designer-form/src/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java

@ -3,19 +3,6 @@
*/
package com.fr.design.designer.creator.cardlayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Rectangle;
import java.awt.event.ContainerEvent;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import javax.swing.border.Border;
import com.fr.base.GraphHelper;
import com.fr.base.ScreenResolution;
import com.fr.design.designer.beans.AdapterBus;
@ -33,6 +20,7 @@ import com.fr.design.form.layout.FRFlowLayout;
import com.fr.design.form.layout.FRHorizontalLayout;
import com.fr.design.form.layout.FRVerticalLayout;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.EditingMouseListener;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;
@ -45,6 +33,18 @@ import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont;
import javax.swing.border.Border;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Rectangle;
import java.awt.event.ContainerEvent;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
/**
* @date: 2014-11-25-下午3:11:14
*/
@ -239,6 +239,11 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout {
}
}
@Override
public UIPopupMenu createPopupMenu(FormDesigner formDesigner) {
return UIPopupMenu.EMPTY; // 不要菜单
}
public int[] getDirections() {
return ((XCreator)getParent()).getDirections();
}

17
designer-form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java

@ -11,23 +11,29 @@ import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormHierarchyTreePane;
import com.fr.design.mainframe.widget.editors.ButtonTypeEditor;
import com.fr.design.mainframe.widget.editors.ImgBackgroundEditor;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.general.Background;
import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils;
import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.border.Border;
import java.awt.*;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Rectangle;
import java.beans.IntrospectionException;
@ -98,6 +104,11 @@ public class XWTabFitLayout extends XWFitLayout {
super(widget, initSize);
}
@Override
public UIPopupMenu createPopupMenu(FormDesigner formDesigner) {
return UIPopupMenu.EMPTY; // 不要菜单
}
/**
* 得到属性名
* @return 属性名

5
designer-form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java

@ -98,11 +98,6 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr
if (row == 0) {
if (state == WBodyLayoutType.FIT.getTypeValue()) {
return switch2FitBodyLayout();
} else {
XWFitLayout xfl = (XWFitLayout) xwAbsoluteLayout.getBackupParent();
if (xfl.toData().removeMargin()) {
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified();
}
}
}
if (row == 1) {

1
designer-form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java

@ -152,7 +152,6 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel {
wAbsoluteBodyLayout.setCompState(WAbsoluteLayout.STATE_FIXED);
Component[] components = xfl.getComponents();
xfl.removeAll();
xfl.toData().removeMargin();
XWAbsoluteBodyLayout xwAbsoluteBodyLayout = new XWAbsoluteBodyLayout(wAbsoluteBodyLayout, new Dimension(0, 0));
xfl.getLayoutAdapter().addBean(xwAbsoluteBodyLayout, 0, 0);
for (Component component : components) {

26
designer-form/src/com/fr/design/form/mobile/FormMobileAttrPane.java

@ -15,25 +15,29 @@ import java.awt.*;
public class FormMobileAttrPane extends BasicBeanPane<FormMobileAttr>{
//工具栏容器
private MobileToolBarPane mobileToolBarPane;
// 模版设置面板
private FormMobileTemplateSettingsPane formMobileTemplateSettingsPane;
static final int PADDINGHEIGHT = 10;
private static final int PADDING = 10;
public FormMobileAttrPane() {
this.initComponents();
}
//现在只有两个panel,填不满自适应对话框,只能为工具栏Panel和h5解析方式panel分别包裹上一层Panel再计算高度,不然会自动
//拉长两个Panel的高度去填满整个对话框。
private void initComponents() {
JPanel jPanel1 = new JPanel();
this.setLayout(FRGUIPaneFactory.createBorderLayout());
jPanel1.setLayout(FRGUIPaneFactory.createBorderLayout());
jPanel1.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
JPanel mobileToolBarPaneWrapper = new JPanel(new BorderLayout());
mobileToolBarPaneWrapper.setBorder(BorderFactory.createEmptyBorder(PADDING, PADDING, 0, PADDING));
this.mobileToolBarPane = new MobileToolBarPane();
//设置一个JPanel包裹mobileToolBarPane这个Panel,让jPanel的高度等于mobileToolBarPane高度加10,再放入this中
jPanel1.setPreferredSize(new Dimension(0, (int)this.mobileToolBarPane.getPreferredSize().getHeight() + PADDINGHEIGHT));
jPanel1.add("North", this.mobileToolBarPane);
this.add("North", jPanel1);
mobileToolBarPaneWrapper.add(this.mobileToolBarPane, BorderLayout.NORTH);
JPanel formMobileTemplateSettingsPaneWrapper = new JPanel(new BorderLayout());
formMobileTemplateSettingsPaneWrapper.setBorder(BorderFactory.createEmptyBorder(PADDING, PADDING, PADDING, PADDING));
this.formMobileTemplateSettingsPane = new FormMobileTemplateSettingsPane();
formMobileTemplateSettingsPaneWrapper.add(this.formMobileTemplateSettingsPane, BorderLayout.NORTH);
this.add(formMobileTemplateSettingsPaneWrapper, BorderLayout.NORTH);
this.add(mobileToolBarPaneWrapper, BorderLayout.CENTER);
}
@Override
@ -42,12 +46,14 @@ public class FormMobileAttrPane extends BasicBeanPane<FormMobileAttr>{
ob = new FormMobileAttr();
}
this.mobileToolBarPane.populateBean(ob);
this.formMobileTemplateSettingsPane.populateBean(ob);
}
@Override
public FormMobileAttr updateBean() {
FormMobileAttr formMobileAttr = new FormMobileAttr();
this.mobileToolBarPane.updateBean(formMobileAttr);
this.formMobileTemplateSettingsPane.updateBean(formMobileAttr);
return formMobileAttr;
}

160
designer-form/src/com/fr/design/form/mobile/FormMobileTemplateSettingsPane.java

@ -0,0 +1,160 @@
package com.fr.design.form.mobile;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.mobile.MobileRadioCheckPane;
import com.fr.design.event.UIObserverListener;
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.form.main.mobile.FormMobileAttr;
import com.fr.general.Inter;
import javax.swing.*;
import javax.swing.border.Border;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* Created by plough on 2018/1/4.
*/
public class FormMobileTemplateSettingsPane extends BasicBeanPane<FormMobileAttr> {
private UICheckBox mobileOnlyCheck; // 设置为手机端专属模版
private UICheckBox mobileCanvasSizeCheck; // 设置为手机模版画布大小
private UICheckBox adaptivePropertyAutoMatchCheck; // 自适应属性自动匹配
public FormMobileTemplateSettingsPane() {
this.initComponents();
}
private void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel borderPane = FRGUIPaneFactory.createTitledBorderPane(this.title4PopupWindow());
JPanel contentPane = new JPanel(FRGUIPaneFactory.createBorderLayout());
contentPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L5, IntervalConstants.INTERVAL_L2, 0));
JPanel mobileSettingsPane = new JPanel(FRGUIPaneFactory.createBorderLayout());
mobileSettingsPane.setVisible(false);
mobileSettingsPane.add(getMobileCanvasSizeCheckPane(), BorderLayout.NORTH);
mobileSettingsPane.add(getAdaptivePropertyAutoMatchCheckPane(), BorderLayout.CENTER);
mobileOnlyCheck = new UICheckBox(Inter.getLocText("FR-Designer_Set_Mobile_Only_Template"));
mobileOnlyCheck.registerChangeListener(new UIObserverListener() {
@Override
public void doChange() {
boolean mobileOnlyCheckSelected = mobileOnlyCheck.isSelected();
mobileSettingsPane.setVisible(mobileOnlyCheckSelected);
if (mobileOnlyCheckSelected) {
adaptivePropertyAutoMatchCheck.setSelected(true);
}
}
});
contentPane.add(mobileOnlyCheck, BorderLayout.NORTH);
contentPane.add(mobileSettingsPane, BorderLayout.CENTER);
borderPane.add(contentPane);
this.add(borderPane);
}
private JPanel getMobileCanvasSizeCheckPane() {
JPanel panel = new JPanel(FRGUIPaneFactory.createBorderLayout());
mobileCanvasSizeCheck = new UICheckBox(Inter.getLocText("FR-Designer_Set_Mobile_Canvas_Size"));
// 默认勾选,不可取消
mobileCanvasSizeCheck.setSelected(true);
mobileCanvasSizeCheck.setEnabled(false);
panel.add(mobileCanvasSizeCheck, BorderLayout.NORTH);
panel.add(getCanvasDescPane(), BorderLayout.CENTER);
panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L6, 0));
return panel;
}
private JPanel getAdaptivePropertyAutoMatchCheckPane() {
JPanel panel = new JPanel(FRGUIPaneFactory.createBorderLayout());
adaptivePropertyAutoMatchCheck = new UICheckBox();
adaptivePropertyAutoMatchCheck.registerChangeListener(new UIObserverListener() {
@Override
public void doChange() {
adaptivePropertyAutoMatchCheck.setText(Inter.getLocText("FR-Designer_Adaptive_Property_Auto_Match"));
}
});
adaptivePropertyAutoMatchCheck.setSelected(true);
panel.add(adaptivePropertyAutoMatchCheck, BorderLayout.NORTH);
panel.add(getAdaptivePropertyAutoMatchDescPane(), BorderLayout.CENTER);
return panel;
}
private JPanel getCanvasDescPane() {
UILabel desc1 = createDescLabel(Inter.getLocText("FR-Designer_Canvas_Size_Lock_Desc"));
UILabel desc2 = createDescLabel(Inter.getLocText("FR-Designer_Mobile_Screen_Match_Desc"));
UILabel desc3 = createDescLabel(Inter.getLocText("FR-Designer_Mobile_Screen_Zoom_In_Desc"));
UILabel desc4 = createDescLabel(Inter.getLocText("FR-Designer_Mobile_Screen_Zoom_Out_Desc"));
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}};
Component[][] components = new Component[][]{
new Component[]{desc1, null},
new Component[]{desc2, null},
new Component[]{desc3, null},
new Component[]{desc4, null}
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W0, IntervalConstants.INTERVAL_L1);
panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_W4, IntervalConstants.INTERVAL_L1, 0));
return panel;
}
private JPanel getAdaptivePropertyAutoMatchDescPane() {
UILabel desc1 = createDescLabel(Inter.getLocText("FR-Designer_Adaptive_Property_Auto_Match_Desc"));
JPanel panel = new JPanel(FRGUIPaneFactory.createBorderLayout());
panel.add(desc1, BorderLayout.CENTER);
panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_W4, IntervalConstants.INTERVAL_L1, 0));
return panel;
}
private UILabel createDescLabel(String desc) {
UILabel label = new UILabel(desc);
label.setForeground(Color.gray);
return label;
}
@Override
public void populateBean(FormMobileAttr ob) {
if (ob == null) {
ob = new FormMobileAttr();
}
// this.mobileOnlyCheckPane.populateBean(ob.isRefresh());
mobileOnlyCheck.setSelected(ob.isMobileOnly());
adaptivePropertyAutoMatchCheck.setSelected(ob.isAdaptivePropertyAutoMatch());
}
@Override
public FormMobileAttr updateBean() {
return null;
}
@Override
public void updateBean(FormMobileAttr mobileAttr) {
if(mobileAttr != null) {
mobileAttr.setMobileOnly(mobileOnlyCheck.isSelected());
mobileAttr.setAdaptivePropertyAutoMatch(adaptivePropertyAutoMatchCheck.isSelected());
}
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Template_Settings");
}
}

24
designer-form/src/com/fr/design/mainframe/EditingMouseListener.java

@ -9,11 +9,18 @@ import com.fr.design.designer.beans.location.Direction;
import com.fr.design.designer.beans.location.Location;
import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.designer.beans.models.StateModel;
import com.fr.design.designer.creator.*;
import com.fr.design.designer.creator.XChartEditor;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XEditorHolder;
import com.fr.design.designer.creator.XElementCase;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.cardlayout.XCardSwitchButton;
import com.fr.design.designer.creator.cardlayout.XWCardLayout;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.gui.xpane.ToolTipEditor;
import com.fr.design.icon.IconPathConstants;
import com.fr.design.utils.ComponentUtils;
@ -22,9 +29,16 @@ import com.fr.design.utils.gui.LayoutUtils;
import com.fr.general.Inter;
import com.fr.stable.Constants;
import javax.swing.*;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPopupMenu;
import javax.swing.JWindow;
import javax.swing.SwingUtilities;
import javax.swing.event.MouseInputAdapter;
import java.awt.*;
import java.awt.Color;
import java.awt.Container;
import java.awt.Cursor;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
/**
@ -540,8 +554,8 @@ public class EditingMouseListener extends MouseInputAdapter {
if (creator != null) {
creator.respondClick(this, e);
if (e.getButton() == MouseEvent.BUTTON3) {
JPopupMenu cellPopupMenu = creator.createPopupMenu(designer);
if (cellPopupMenu != null) {
UIPopupMenu cellPopupMenu = creator.createPopupMenu(designer);
if (cellPopupMenu != UIPopupMenu.EMPTY) {
GUICoreUtils.showPopupMenu(cellPopupMenu, designer, e.getX(), e.getY());
}
}

44
designer-form/src/com/fr/design/mainframe/FormArea.java

@ -7,25 +7,47 @@ import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWBorderLayout;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.scrollruler.*;
import com.fr.design.scrollruler.BaseRuler;
import com.fr.design.scrollruler.HorizontalRuler;
import com.fr.design.scrollruler.RulerLayout;
import com.fr.design.scrollruler.ScrollRulerComponent;
import com.fr.design.scrollruler.VerticalRuler;
import com.fr.design.utils.ComponentUtils;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.main.mobile.FormMobileAttr;
import com.fr.form.ui.container.WBorderLayout;
import com.fr.general.FRScreen;
import com.fr.general.Inter;
import javax.swing.*;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.border.LineBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.*;
import java.awt.AWTEvent;
import java.awt.Adjustable;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
public class FormArea extends JComponent implements ScrollRulerComponent {
@ -36,6 +58,8 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
private static final int SHOWVALMAX = 400;
private static final int SHOWVALMIN = 10;
private static final int RESIZE_PANE_GAP = 8;
private static final int MOBILE_ONLY_WIDTH = 375;
private static final int MOBILE_ONLY_HEIGHT = 560;
private FormDesigner designer;
private int horizontalValue = 0;
private int verticalValue = 0;
@ -79,6 +103,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
this.add(FormRulerLayout.VERTICAL, verScrollBar);
this.add(FormRulerLayout.HIRIZONTAL, horScrollBar);
enableEvents(AWTEvent.MOUSE_WHEEL_EVENT_MASK);
widthPane.setEnabled(!designer.getTarget().getFormMobileAttr().isMobileOnly());
} else {
// 报表参数界面只要标尺和中心pane
this.setLayout(new RulerLayout());
@ -89,6 +114,17 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
this.designer.addMouseWheelListener(showValSpinnerMouseWheelListener);
}
public void onMobileAttrModified() {
FormMobileAttr formMobileAttr = designer.getTarget().getFormMobileAttr();
if (formMobileAttr.isMobileOnly()) {
widthPane.setValue(MOBILE_ONLY_WIDTH);
changeWidthPaneValue(MOBILE_ONLY_WIDTH);
heightPane.setValue(MOBILE_ONLY_HEIGHT);
changeHeightPaneValue(MOBILE_ONLY_HEIGHT);
}
widthPane.setEnabled(!formMobileAttr.isMobileOnly());
}
MouseWheelListener showValSpinnerMouseWheelListener = new MouseWheelListener() {
@Override
public void mouseWheelMoved(MouseWheelEvent e) {

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

@ -148,6 +148,8 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
new FormDesignerDropTarget(this);// 添加Drag and Drop.
this.switchAction = switchAction;
// 必须刷新"参数/控件树"面板,否则,若最近一次打开模版为 cpt,重启设计器,打开 frm,控件树消失
populateParameterPropertyPane();
}
@ -1013,6 +1015,9 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
*/
@Override
public void valueChanged(TreeSelectionEvent e) {
if (DesignerContext.getDesignerFrame().getSelectedJTemplate() == null) { // 初始化完成前,不响应事件
return;
}
ComponentTree tree = (ComponentTree) e.getSource();
TreePath[] paths = tree.getSelectionPaths();
@ -1026,9 +1031,11 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
if (!BaseUtils.isAuthorityEditing()) {
selectionModel.setSelectedCreators(selected);
TreePath path = e.getNewLeadSelectionPath();
XCreator comp = (XCreator) path.getLastPathComponent();
formArea.scrollPathToVisible(comp);
if (formArea != null) {
TreePath path = e.getNewLeadSelectionPath();
XCreator comp = (XCreator) path.getLastPathComponent();
formArea.scrollPathToVisible(comp);
}
} else {
showAuthorityEditPane();
}
@ -1139,8 +1146,8 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
// 当前选中控件可以上移一层吗?
public boolean isCurrentComponentMovableUp() {
XCreator creator = getSelectionModel().getSelection().getSelectedCreator();
Container container = creator.getParent();
if (container == null) {
XLayoutContainer container = (XLayoutContainer) creator.getParent();
if (container == null || !container.supportInnerOrderChangeActions()) {
return false;
}
return creator.isMovable() && container.getComponentZOrder(creator) > 0;
@ -1149,8 +1156,8 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
// 当前选中控件可以下移一层吗?
public boolean isCurrentComponentMovableDown() {
XCreator creator = getSelectionModel().getSelection().getSelectedCreator();
Container container = creator.getParent();
if (container == null) {
XLayoutContainer container = (XLayoutContainer) creator.getParent();
if (container == null || !container.supportInnerOrderChangeActions()) {
return false;
}
return creator.isMovable() && container.getComponentZOrder(creator) < container.getComponentCount() - 1;

24
designer-form/src/com/fr/design/mainframe/FormHierarchyTreePane.java

@ -13,15 +13,22 @@ import com.fr.design.gui.controlpane.ShortCut4JControlPane;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itoolbar.UIToolBarUI;
import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.gui.style.BorderPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef;
import com.fr.design.parameter.HierarchyTreePane;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
import javax.swing.Action;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.util.ArrayList;
@ -96,8 +103,7 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree
formDesigner.addDesignerEditListener(new DesignerEditListener() {
@Override
public void fireCreatorModified(DesignerEvent evt) {
componentTree.setAndScrollSelectionPath(componentTree.getSelectedTreePath());
componentTree.refreshUI();
refreshComponentTree();
}
});
@ -110,6 +116,14 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree
}
add(getWidgetPane(), BorderLayout.CENTER);
// 这里要刷新一下,否则控件树中没有任何一个控件处于选中状态
refreshComponentTree();
}
private void refreshComponentTree() {
componentTree.setAndScrollSelectionPath(componentTree.getSelectedTreePath());
componentTree.refreshUI();
}
private JPanel getWidgetPane() {

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

@ -1,6 +1,7 @@
package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.base.PaperSize;
import com.fr.design.DesignState;
import com.fr.design.actions.core.WorkBookSupportable;
import com.fr.design.actions.file.WebPreviewUtils;
@ -53,15 +54,26 @@ import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.WLayout;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.page.PaperSettingProvider;
import com.fr.report.worksheet.FormElementCase;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Constants;
import com.fr.stable.bridge.StableFactory;
import com.fr.web.controller.ViewRequestConstants;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
@ -246,9 +258,14 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
private XComponent lastAffectedCreator;
@Override
public void fireCreatorModified(DesignerEvent evt) {
if (evt.getCreatorEventID() == DesignerEvent.CREATOR_CUTED
|| evt.getCreatorEventID() == DesignerEvent.CREATOR_DELETED) {
if (formDesign.getArea() == null || !formDesign.getArea().isValid()) {
return;
}
if (evt.getCreatorEventID() == DesignerEvent.CREATOR_CUTED) {
setPropertyPaneChange(formDesign.getRootComponent());
} else if (evt.getCreatorEventID() == DesignerEvent.CREATOR_DELETED) {
// 在 delete 之前,会先 select 父组件。这里直接传入 lastAffectedCreator 就好了
setPropertyPaneChange(lastAffectedCreator);
} else if (evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) {
lastAffectedCreator = evt.getAffectedCreator();
setPropertyPaneChange(lastAffectedCreator);
@ -795,6 +812,14 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
}
}
/**
* 模板更新
*/
public void fireTargetModified() {
super.fireTargetModified();
WidgetPropertyPane.getInstance().refreshDockingView();
}
/**
* 在Form和ElementCase, 以及ElementCase和ElementCase之间切换
*
@ -820,8 +845,13 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
HashMap<String, Class> designerClass = new HashMap<String, Class>();
designerClass.put(Constants.ARG_0, FormElementCaseProvider.class);
Object[] designerArg = new Object[]{formDesign.getElementCase()};
return StableFactory.getMarkedInstanceObjectFromClass(FormECDesignerProvider.XML_TAG, designerArg, designerClass, FormECDesignerProvider.class);
Object[] designerArg = new Object[]{formDesign.getElementCase(), getTarget()};
FormECDesignerProvider formECDesigner = StableFactory.getMarkedInstanceObjectFromClass(FormECDesignerProvider.XML_TAG, designerArg, designerClass, FormECDesignerProvider.class);
// 如果是移动端专属模版,需要修改页面大小并显示边缘线
PaperSettingProvider paperSetting = ((FormElementCase)formECDesigner.getEditingElementCase()).getReportSettings().getPaperSetting();
paperSetting.setPaperSize(getTarget().getFormMobileAttr().isMobileOnly() ? PaperSize.PAPERSIZE_MOBILE : new PaperSize());
return formECDesigner;
}
/**

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

@ -6,13 +6,17 @@ import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.form.mobile.FormMobileAttrPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.FormArea;
import com.fr.design.mainframe.JForm;
import com.fr.design.menu.MenuKeySet;
import com.fr.form.main.Form;
import com.fr.form.main.mobile.FormMobileAttr;
import com.fr.general.Inter;
import com.fr.plugin.ExtraClassManager;
import com.fr.stable.ReportFunctionProcessor;
import com.fr.stable.fun.FunctionProcessor;
import javax.swing.*;
import javax.swing.KeyStroke;
import java.awt.event.ActionEvent;
/**
@ -47,8 +51,16 @@ public class FormMobileAttrAction extends JTemplateAction<JForm> {
BasicDialog dialog = mobileAttrPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
formTpl.setFormMobileAttr(mobileAttrPane.updateBean());
FormMobileAttr formMobileAttr = mobileAttrPane.updateBean();
formTpl.setFormMobileAttr(formMobileAttr);
((FormArea)jf.getFormDesign().getParent()).onMobileAttrModified();
jf.fireTargetModified();
if (formMobileAttr.isMobileOnly()) {
FunctionProcessor processor = ExtraClassManager.getInstance().getFunctionProcessor();
if (processor != null) {
processor.recordFunction(ReportFunctionProcessor.MOBILE_TEMPLATE_FRM);
}
}
}
});
dialog.setVisible(true);

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

@ -4,10 +4,17 @@ import com.fr.design.constants.UIConstants;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.dialog.BasicScrollPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.*;
import javax.swing.*;
import java.awt.*;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormHierarchyTreePane;
import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.JTemplate;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
@ -26,6 +33,7 @@ public class ParameterPropertyPane extends JPanel{
private static final int PADDING_SMALL = 5;
private static final int PADDING_MIDDLE = 10;
private static final int PADDING_LARGE = 15;
private static final int ADD_PARA_PANE_MAX_HEIGHT = 95;
public static final ParameterPropertyPane getInstance() {
if (THIS == null) {
@ -86,6 +94,7 @@ public class ParameterPropertyPane extends JPanel{
// 显示或隐藏添加参数面板
public void refreshState(JTemplate jt) {
setAddParaPaneVisible(toolbarPane.hasSelectedLabelItem(), jt);
updateAddParaPaneSize();
}
// 显示或隐藏添加参数面板
@ -93,6 +102,16 @@ public class ParameterPropertyPane extends JPanel{
refreshState(DesignerContext.getDesignerFrame().getSelectedJTemplate());
}
private void updateAddParaPaneSize() {
if (!addParaPane.isVisible()) {
return;
}
addParaPane.setPreferredSize(null);
int height = Math.min(addParaPane.getPreferredSize().height, ADD_PARA_PANE_MAX_HEIGHT);
addParaPane.setPreferredSize(new Dimension(addParaPane.getPreferredSize().width, height));
repaintContainer();
}
public void setAddParaPaneVisible(boolean isVisible, JTemplate jt) {
if (isVisible == addParaPane.isVisible() || formHierarchyTreePaneWrapper == null) {
return;
@ -112,7 +131,6 @@ public class ParameterPropertyPane extends JPanel{
addParaPane.setVisible(false);
this.setPreferredSize(new Dimension(getWidth(), formHierarchyTreePaneWrapper.getPreferredSize().height + UIConstants.GAP_NORMAL));
}
repaintContainer();
}
private void setEditor(FormDesigner editor) {

1
designer-form/src/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java

@ -115,6 +115,7 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane {
}
if (layoutType == WBodyLayoutType.ABSOLUTE) {
((XWFitLayout)creator.getBackupParent()).toData().resetStyle();
if (state == WBodyLayoutType.FIT.getTypeValue()) {
switch2FitBodyLayout();
}

1
designer-form/src/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java

@ -176,6 +176,7 @@ public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
wAbsoluteBodyLayout.setCompState(WAbsoluteLayout.STATE_FIXED);
Component[] components = xWFitLayout.getComponents();
xWFitLayout.removeAll();
layout.resetStyle();
XWAbsoluteBodyLayout xwAbsoluteBodyLayout = new XWAbsoluteBodyLayout(wAbsoluteBodyLayout, new Dimension(0, 0));
xWFitLayout.getLayoutAdapter().addBean(xwAbsoluteBodyLayout, 0, 0);
for (Component component : components) {

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

@ -25,7 +25,7 @@ public class DeleteAction extends ElementCaseAction {
this.setMnemonic('D');
//Richie:删除菜单图标
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));
}
@Override

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

@ -27,7 +27,7 @@ public class BringFloatElementForwardAction extends AbstractFloatElementOrderAct
this.setName(Inter.getLocText("M_Edit-Bring_Forward"));
this.setMnemonic('F');
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));
}
@Override

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

@ -28,7 +28,7 @@ public class BringFloatElementToFrontAction extends AbstractFloatElementOrderAct
this.setName(Inter.getLocText("M_Edit-Bring_to_Front"));
this.setMnemonic('T');
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.ALT_MASK));
}
@Override

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

@ -27,7 +27,7 @@ public class SendFloatElementBackwardAction extends AbstractFloatElementOrderAct
this.setName(Inter.getLocText("M_Edit-Send_Backward"));
this.setMnemonic('B');
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));
}
@Override

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

@ -28,7 +28,7 @@ public class SendFloatElementToBackAction extends AbstractFloatElementOrderActio
this.setName(Inter.getLocText("M_Edit-Send_to_Back"));
this.setMnemonic('K');
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.ALT_MASK));
}
@Override

12
designer-realize/src/com/fr/design/actions/report/ReportMobileAttrAction.java

@ -11,7 +11,10 @@ import com.fr.design.report.mobile.ReportMobileAttrPane;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.main.TemplateWorkBook;
import com.fr.plugin.ExtraClassManager;
import com.fr.report.mobile.ElementCaseMobileAttr;
import com.fr.stable.ReportFunctionProcessor;
import com.fr.stable.fun.FunctionProcessor;
import javax.swing.*;
import java.awt.event.ActionEvent;
@ -50,8 +53,15 @@ public class ReportMobileAttrAction extends JWorkBookAction{
BasicDialog dialog = mobileAttrPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
wbTpl.setReportMobileAttr(mobileAttrPane.updateBean());
ElementCaseMobileAttr elementCaseMobileAttr = mobileAttrPane.updateBean();
wbTpl.setReportMobileAttr(elementCaseMobileAttr);
jwb.fireTargetModified();
if (elementCaseMobileAttr.isMobileCanvasSize()) {
FunctionProcessor processor = ExtraClassManager.getInstance().getFunctionProcessor();
if (processor != null) {
processor.recordFunction(ReportFunctionProcessor.MOBILE_TEMPLATE_CPT);
}
}
}
});
dialog.setVisible(true);

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

@ -27,6 +27,7 @@ import com.fr.design.selection.SelectableElement;
import com.fr.design.selection.Selectedable;
import com.fr.design.selection.SelectionListener;
import com.fr.form.FormElementCaseProvider;
import com.fr.form.main.Form;
import com.fr.general.Inter;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.Selection;
@ -54,11 +55,11 @@ public class FormElementCaseDesigner<T extends FormElementCaseProvider, E extend
return elementCasePane;
}
public FormElementCaseDesigner(T sheet) {
public FormElementCaseDesigner(T sheet, Form form) {
super(sheet);
this.setLayout(FRGUIPaneFactory.createBorderLayout());
elementCasePane = new FormElementCasePaneDelegate((FormElementCase) sheet);
elementCasePane = new FormElementCasePaneDelegate((FormElementCase) sheet, form);
elementCasePane.setSelection(getDefaultSelectElement());
this.add(elementCasePane, BorderLayout.CENTER);
elementCasePane.addTargetModifiedListener(new TargetModifiedListener() {

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

@ -20,6 +20,7 @@ import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef;
import com.fr.design.present.ConditionAttributesGroupPane;
import com.fr.form.main.Form;
import com.fr.js.NameJavaScriptGroup;
import com.fr.page.ReportSettingsProvider;
import com.fr.report.elementcase.TemplateElementCase;
@ -31,8 +32,9 @@ import com.fr.design.selection.SelectionListener;
*/
public class FormElementCasePaneDelegate extends ElementCasePane<FormElementCase>{
public FormElementCasePaneDelegate(FormElementCase sheet) {
public FormElementCasePaneDelegate(FormElementCase sheet, Form form) {
super(sheet);
this.getGrid().setShowPaginateLine(form.getFormMobileAttr().isMobileOnly());
this.addSelectionChangeListener(new SelectionListener() {
@Override
public void selectionChanged(SelectionEvent e) {

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

@ -73,14 +73,6 @@ public class PageSetupPane extends BasicPane {
private OtherPane otherPane;
private UILabel zeroMarginWarn;
public final static PaperSize MOBILE_SMAIL_SIZE = new PaperSize(new MM(142.8f), new MM(254));
public final static PaperSize MOBILE_LARGE_SIZE = new PaperSize(new MM(190.5f), new MM(338.7f));
public static final Object[][] MOBILE_NAME_SIZE_ARRAY = {
{Inter.getLocText("FR-Designer_PaperSize-Mobile-Large"),MOBILE_LARGE_SIZE},
{Inter.getLocText("FR-Designer_PaperSize-Mobile-Small"),MOBILE_SMAIL_SIZE}
};
public PageSetupPane() {
this.initComponents();
}
@ -135,12 +127,10 @@ public class PageSetupPane extends BasicPane {
private UIRadioButton landscapeRadioButton;
private UIRadioButton predefinedRadioButton;
private UIRadioButton mobileRadioButton;
private UIRadioButton customRadioButton;
private UIComboBox predefinedComboBox;
private UIComboBox mobileComboBox;
private UIBasicSpinner paperWidthSpinner;
private UIBasicSpinner paperHeightSpinner;
private UIComboBox switchInch;
@ -206,24 +196,16 @@ public class PageSetupPane extends BasicPane {
paperSizePane.add(innerpaperSizePane);
defaultPane.add(paperSizePane);
predefinedRadioButton = new UIRadioButton(Inter.getLocText("PageSetup-Predefined") + ":");
predefinedRadioButton.setMnemonic('P');
predefinedRadioButton.addActionListener(previewListener);
mobileRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer_MobilePhone") + " :");
mobileRadioButton.setMnemonic('M');
mobileRadioButton.addActionListener(previewListener);
customRadioButton = new UIRadioButton(Inter.getLocText("Custom") + ":");
customRadioButton.setMnemonic('C');
customRadioButton.addActionListener(previewListener);
predefinedComboBox = new UIComboBox();
mobileComboBox = new UIComboBox();
paperWidthSpinner = new UIBasicSpinner(new SpinnerNumberModel(0.0, 0.0, Double.MAX_VALUE, 1.0));
((JSpinner.DefaultEditor) paperWidthSpinner.getEditor()).getTextField().setColumns(7);
paperHeightSpinner = new UIBasicSpinner(new SpinnerNumberModel(0.0, 0.0, Double.MAX_VALUE, 1.0));
@ -239,9 +221,7 @@ public class PageSetupPane extends BasicPane {
predefinedComboBox.setRenderer(paperSizeCellRenderere);
predefinedComboBox.addItemListener(paperSizeItemListener);
mobileComboBox.setRenderer(paperSizeMobileCellRenderere);
mobileComboBox.addItemListener(paperSizeItemMobileListener);
((JSpinner.DefaultEditor) paperWidthSpinner.getEditor()).getTextField().getDocument().addDocumentListener(customTextListener);
((JSpinner.DefaultEditor) paperHeightSpinner.getEditor()).getTextField().getDocument().addDocumentListener(customTextListener);
@ -253,11 +233,6 @@ public class PageSetupPane extends BasicPane {
Object[] tmpPaperSizeNameArray = ReportConstants.PaperSizeNameSizeArray[i];
predefinedComboBox.addItem(tmpPaperSizeNameArray[1]);
}
for(int i=0; i<MOBILE_NAME_SIZE_ARRAY.length;i++){
Object[] tmpPaperSizeNameArray = MOBILE_NAME_SIZE_ARRAY[i];
mobileComboBox.addItem(tmpPaperSizeNameArray[1]);
}
// tow radio buttons.
@ -266,17 +241,9 @@ public class PageSetupPane extends BasicPane {
radioButtonPane.add(predefinedRadioButton);
radioButtonPane.add(predefinedComboBox);
// tow radio buttons.
JPanel mobileButtonPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
innerpaperSizePane.add(mobileButtonPane);
mobileButtonPane.add(mobileRadioButton);
mobileButtonPane.add(mobileComboBox);
ButtonGroup paperSizeRadioButtonGroup = new ButtonGroup();
paperSizeRadioButtonGroup.add(predefinedRadioButton);
paperSizeRadioButtonGroup.add(mobileRadioButton);
paperSizeRadioButtonGroup.add(customRadioButton);
// size and textfields.
@ -457,17 +424,27 @@ public class PageSetupPane extends BasicPane {
break;
}
}
for(int i=0; i<MOBILE_NAME_SIZE_ARRAY.length; i++){
Object[] mobileNameSizeArray = MOBILE_NAME_SIZE_ARRAY[i];
if(ComparatorUtils.equals(paperSize, mobileNameSizeArray[1])){
this.mobileComboBox.setSelectedIndex(i);
this.mobileRadioButton.setSelected(true);
isCustomed = false;
break;
}
}
setAndPopulate(isCustomed, unitType);
populateMargin();
checkMobileSetting(report);
}
private void checkMobileSetting(Report report) {
if (report.getBook().getReportMobileAttr().isMobileCanvasSize()) {
// 当勾选移动端画布大小后,自定义选项不可修改;限制宽度范围
predefinedRadioButton.setEnabled(false);
predefinedComboBox.setEnabled(false);
double maxWidth;
if (unitType == Constants.UNIT_MM) { // 毫米
maxWidth = PaperSize.PAPERSIZE_MOBILE.getWidth().toMMValue4Scale2();
} else { // 英寸
maxWidth = PaperSize.PAPERSIZE_MOBILE.getWidth().toINCHValue4Scale3();
}
maxWidth = Math.round(maxWidth * 100) / 100.0; // 保留两位小数
((SpinnerNumberModel)paperWidthSpinner.getModel()).setMaximum(maxWidth);
}
}
private void unitSet(int unitType) {
@ -539,13 +516,6 @@ public class PageSetupPane extends BasicPane {
} catch (CloneNotSupportedException cloneNotSupportedException) {
// do nothing
}
}else if(this.mobileRadioButton.isSelected()){
try {
psetting.setPaperSize((PaperSize) ((PaperSize) mobileComboBox.getSelectedItem()).clone());
} catch (CloneNotSupportedException cloneNotSupportedException) {
// do nothing
}
} else if (this.customRadioButton.isSelected()) {
if (unitType == Constants.UNIT_CM) {
psetting.setPaperSize(new PaperSize(new CM(((Number) this.paperWidthSpinner.getValue()).floatValue()), new CM(
@ -616,10 +586,7 @@ public class PageSetupPane extends BasicPane {
if (this.predefinedRadioButton.isSelected()) {
ps = (PaperSize) predefinedComboBox.getSelectedItem();
showPagePaneByType(ps,ori);
} else if(this.mobileRadioButton.isSelected()){
ps = (PaperSize) mobileComboBox.getSelectedItem();
showPagePaneByType(ps, ori);
}else if (this.customRadioButton.isSelected()) {
} else if (this.customRadioButton.isSelected()) {
showPagePane.populate(((Number) this.paperWidthSpinner.getValue()).doubleValue(),
((Number) this.paperHeightSpinner.getValue()).doubleValue(), ori, unitType == Constants.UNIT_MM);
}
@ -691,34 +658,7 @@ public class PageSetupPane extends BasicPane {
}
sbuf.append(']');
}
/**
* Paper size cell renderer.
*/
private UIComboBoxRenderer paperSizeMobileCellRenderere = 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 < MOBILE_NAME_SIZE_ARRAY.length; i++) {
Object[] tmpPaperSizeNameArray = MOBILE_NAME_SIZE_ARRAY[i];
if (ComparatorUtils.equals(paperSize, tmpPaperSizeNameArray[1])) {
StringBuffer sbuf = new StringBuffer(tmpPaperSizeNameArray[0].toString());
adjustCellRenderByType(sbuf,paperSize);
this.setText(sbuf.toString());
break;
}
}
}
return this;
}
};
/**
* Paper size item listener.
@ -744,18 +684,6 @@ public class PageSetupPane extends BasicPane {
paperHeightSpinner.setValue(new Float(paperSize.getHeight().toMMValue4Scale2()));
}
}
/**
* Paper size item listener.
*/
private ItemListener paperSizeItemMobileListener = new ItemListener() {
public void itemStateChanged(ItemEvent evt) {
PaperSize paperSize = (PaperSize) mobileComboBox.getSelectedItem();
adjustSpinnerValueByType(paperSize);
mobileRadioButton.setSelected(true);
previewShowPagePane();
}
};
// text listener.
DocumentListener customTextListener = new DocumentListener() {

9
designer-realize/src/com/fr/design/report/mobile/ReportMobileAttrPane.java

@ -13,8 +13,8 @@ import javax.swing.*;
public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr>{
private ReportMobileTemplateSettingsPane reportMobileTemplateSettingsPane; // 模版设置面板
private AppFitBrowserPane appFitBrowserPane;
//工具栏容器
private MobileToolBarPane mobileToolBarPane;
@ -28,6 +28,10 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr>{
JPanel jPanel = new JPanel();
jPanel.setLayout(new BoxLayout(jPanel, BoxLayout.Y_AXIS));
jPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
reportMobileTemplateSettingsPane = new ReportMobileTemplateSettingsPane();
jPanel.add(reportMobileTemplateSettingsPane);
appFitBrowserPane = new AppFitBrowserPane();
appFitBrowserPane.setAppFitPreviewPane(appFitPreviewPane);
jPanel.add(appFitBrowserPane);
@ -46,13 +50,14 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr>{
}
appFitBrowserPane.populateBean(ob);
mobileToolBarPane.populateBean(ob);
reportMobileTemplateSettingsPane.populateBean(ob);
}
@Override
public ElementCaseMobileAttr updateBean() {
ElementCaseMobileAttr caseMobileAttr = appFitBrowserPane.updateBean();
mobileToolBarPane.updateBean(caseMobileAttr);
reportMobileTemplateSettingsPane.updateBean(caseMobileAttr);
return caseMobileAttr;
}

102
designer-realize/src/com/fr/design/report/mobile/ReportMobileTemplateSettingsPane.java

@ -0,0 +1,102 @@
package com.fr.design.report.mobile;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.Inter;
import com.fr.report.mobile.ElementCaseMobileAttr;
import javax.swing.*;
import java.awt.*;
/**
* Created by plough on 2018/1/8.
*/
public class ReportMobileTemplateSettingsPane extends BasicBeanPane<ElementCaseMobileAttr> {
private UICheckBox mobileCanvasSizeCheck; // 设置为手机模版画布大小
public ReportMobileTemplateSettingsPane() {
this.initComponents();
}
private void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel borderPane = FRGUIPaneFactory.createTitledBorderPane(this.title4PopupWindow());
JPanel contentPane = new JPanel(FRGUIPaneFactory.createBorderLayout());
contentPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L2, 0, 0));
contentPane.add(getMobileCanvasSizeCheckPane(), BorderLayout.CENTER);
borderPane.add(contentPane);
this.add(borderPane);
}
private JPanel getMobileCanvasSizeCheckPane() {
JPanel panel = new JPanel(FRGUIPaneFactory.createBorderLayout());
mobileCanvasSizeCheck = new UICheckBox(Inter.getLocText("FR-Designer_Set_Mobile_Canvas_Size"));
panel.add(mobileCanvasSizeCheck, BorderLayout.NORTH);
panel.add(getCanvasDescPane(), BorderLayout.CENTER);
panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L6, 0));
return panel;
}
private JPanel getCanvasDescPane() {
UILabel desc1 = createDescLabel(Inter.getLocText("FR-Designer_Mobile_Screen_Match_Desc"));
UILabel desc2 = createDescLabel(Inter.getLocText("FR-Designer_Mobile_Screen_Zoom_In_Desc"));
UILabel desc3 = createDescLabel(Inter.getLocText("FR-Designer_Mobile_Screen_Zoom_Out_Desc"));
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}};
Component[][] components = new Component[][]{
new Component[]{desc1, null},
new Component[]{desc2, null},
new Component[]{desc3, null}
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W0, IntervalConstants.INTERVAL_L1);
panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L7, IntervalConstants.INTERVAL_W4, IntervalConstants.INTERVAL_L1, 0));
return panel;
}
private UILabel createDescLabel(String desc) {
UILabel label = new UILabel(desc);
label.setForeground(Color.gray);
return label;
}
@Override
public void populateBean(ElementCaseMobileAttr ob) {
if (ob == null) {
ob = new ElementCaseMobileAttr();
}
mobileCanvasSizeCheck.setSelected(ob.isMobileCanvasSize());
}
@Override
public ElementCaseMobileAttr updateBean() {
ElementCaseMobileAttr mobileAttr = new ElementCaseMobileAttr();
mobileAttr.setMobileCanvasSize(mobileCanvasSizeCheck.isSelected());
return mobileAttr;
}
@Override
public void updateBean(ElementCaseMobileAttr mobileAttr) {
if(mobileAttr != null) {
mobileAttr.setMobileCanvasSize(mobileCanvasSizeCheck.isSelected());
}
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Template_Settings");
}
}

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

@ -583,11 +583,6 @@ public class GridUI extends ComponentUI {
}
private void paintPaginateLines(Graphics g, Grid grid) {
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if(!jTemplate.isJWorkBook()){
//报表块无分页之说
return;
}
Graphics2D g2d = (Graphics2D) g;
// james 画分页线

3
designer-realize/src/com/fr/grid/selection/FloatSelection.java

@ -156,8 +156,9 @@ public class FloatSelection extends Selection {
TemplateElementCase ec = ePane.getEditingElementCase();
FloatElement fe = ec.getFloatElement(selectedFloatName);
if (fe != null) {
ec.removeFloatElement(fe);
// REPORT-5955 [Report]删除悬浮元素后,设计器卡死;之前wu做了释放内存,删除悬浮元素会报npe;删除悬浮元素逻辑改为先setSelection 再 remove
ePane.setSelection(new CellSelection(0, 0, 1, 1));
ec.removeFloatElement(fe);
return true;
}

Loading…
Cancel
Save