Browse Source

Pull request #1755: REPORT-31758【frm自适应重构05.25周】frm设计界面支持缩放

Merge in DESIGN/design from ~KERRY/design_10.0:release/10.0 to release/10.0

* commit '488616bc6427cf67e67297eae7b9035326135424':
  删除无用方法
  REPORT-31758【frm自适应重构05.25周】frm设计界面支持缩放
feature/big-screen
kerry 4 years ago
parent
commit
75c250e1ea
  1. 9
      designer-base/src/main/java/com/fr/design/fun/FormAdaptiveConfigUIProcessor.java
  2. 7
      designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java
  3. 35
      designer-form/src/main/java/com/fr/design/mainframe/FormArea.java
  4. 12
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  5. 12
      designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java

9
designer-base/src/main/java/com/fr/design/fun/FormAdaptiveConfigUIProcessor.java

@ -25,13 +25,10 @@ public interface FormAdaptiveConfigUIProcessor extends Immutable {
ShortCut getConfigShortCut(JTemplate jTemplate);
/**
* 绘制自适应下报表块在表单界面中显示图片
* @param size 绘制尺寸
* @param elementCasePane 报表块内容对象
* @return 自适应下报表块在表单界面中显示的图片
* 是否开启表单滑块缩放功能
* @return 是否开启表单滑块缩放
*/
BufferedImage paintFormElementCaseImage(Dimension size, JComponent elementCasePane);
boolean openFormSliderZoom();
/**
* 获取新自适应下字体显示的dpi

7
designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java

@ -88,6 +88,8 @@ public class JFormSliderPane extends JPanel {
private UIRadioButton customButton;
//拖动条处理和button、直接输入不一样
private boolean isButtonOrIsTxt = true;
//是否选中指定的几个缩放等级,避免触发不必要的事件
private boolean selectSpecified = false;
private FormPopupPane dialog;
private int upButtonX;
private JPanel dialogContentPanel;
@ -288,6 +290,9 @@ public class JFormSliderPane extends JPanel {
refreshBottun(val);
JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField();
textField.setCaretPosition(showValSpinner.getValue().toString().length());
if (!selectSpecified) {
customButton.setSelected(true);
}
}
};
@ -317,7 +322,9 @@ public class JFormSliderPane extends JPanel {
public void itemStateChanged(ItemEvent e) {
JRadioButton temp = (JRadioButton) e.getSource();
if (temp.isSelected()) {
selectSpecified = true;
showValSpinner.setValue(Integer.valueOf(temp.getText().substring(0, temp.getText().indexOf("%"))));
selectSpecified = false;
}
}
};

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

@ -2,12 +2,14 @@ package com.fr.design.mainframe;
import com.fr.base.ScreenResolution;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.ExtraDesignClassManager;
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.designer.creator.XWBorderLayout;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.fun.FormAdaptiveConfigUIProcessor;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.gui.itextfield.UINumberField;
@ -49,7 +51,6 @@ import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
public class FormArea extends JComponent implements ScrollRulerComponent {
private static final double SLIDER_FLOAT = 400.0;
private static final double SLIDER_MIN = 10.0;
public static final double DEFAULT_SLIDER = 100.0;
@ -76,6 +77,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
private int resolution = ScreenResolution.getScreenResolution();
private double screenValue;
public FormScrollBar getHorScrollBar() {
return horScrollBar;
}
@ -113,6 +115,13 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
this.designer.addMouseWheelListener(showValSpinnerMouseWheelListener);
}
private boolean openSliderZoom(){
FormAdaptiveConfigUIProcessor adaptiveConfigUI = ExtraDesignClassManager.getInstance().getSingle(FormAdaptiveConfigUIProcessor.MARK_STRING);
if (adaptiveConfigUI != null) {
return adaptiveConfigUI.openFormSliderZoom();
}
return false;
}
public void onMobileAttrModified() {
FormMobileAttr formMobileAttr = designer.getTarget().getFormMobileAttr();
if (formMobileAttr.isMobileOnly()) {
@ -142,7 +151,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {f};
double[] columnSize = {p, f, p, p, p, p, p, f, p};
double[] columnSize = {p, f, p, p, p, p, p, p};
UILabel tipsPane = new UILabel("form");
tipsPane.setPreferredSize(new Dimension(200, 0));
widthPane = new UINumberField();
@ -150,18 +159,24 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
heightPane = new UINumberField();
heightPane.setPreferredSize(new Dimension(60, 0));
// slidePane = new UINumberSlidePane(SLIDER_MIN, SLIDER_FLOAT);
// slidePane.setPreferredSize(new Dimension(260,20));
slidePane = JFormSliderPane.getInstance();
slidePane.setPreferredSize(new Dimension(200, 20));
JPanel resizePane = TableLayoutHelper.createCommonTableLayoutPane(new JComponent[][]{{ tipsPane, new UILabel(), widthPane, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Indent_Pixel")), new UILabel("x"), heightPane, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Indent_Pixel")), new UILabel(), slidePane }}, rowSize, columnSize, RESIZE_PANE_GAP);
slidePane.setPreferredSize(new Dimension(375, 20));
JPanel resizePane = TableLayoutHelper.createCommonTableLayoutPane(
new JComponent[][]{{tipsPane, new UILabel(), widthPane,
new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Indent_Pixel")),
new UILabel("x"), heightPane,
new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Indent_Pixel")),
slidePane}}, rowSize, columnSize, RESIZE_PANE_GAP);
this.add(FormRulerLayout.BOTTOM, resizePane);
setWidgetsConfig();
boolean needOpenSliderZoom = openSliderZoom();
// 先初始话滑块及对应事件,然后获取分辨率调整容器的显示大小
slidePane.setEnabled(false);
slidePane.setVisible(false);
// initTransparent();
slidePane.setEnabled(needOpenSliderZoom);
slidePane.setVisible(needOpenSliderZoom);
if (needOpenSliderZoom) {
initTransparent();
}
initCalculateSize();
}

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

@ -154,6 +154,12 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
return elementCaseDesign.getEditingElementCasePane();
}
public FormECDesignerProvider getElementCaseDesign() {
return elementCaseDesign;
}
@Override
public JComponent getCurrentReportComponentPane() {
return null;
@ -886,7 +892,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
/**
* 格子编辑组件
*/
private FormECDesignerProvider initElementCaseDesign() {
protected FormECDesignerProvider initElementCaseDesign() {
HashMap<String, Class> designerClass = new HashMap<String, Class>();
designerClass.put(Constants.ARG_0, FormElementCaseProvider.class);
@ -902,7 +908,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
/**
* 整个报表块编辑区域
*/
private FormECCompositeProvider initComposite() {
protected FormECCompositeProvider initComposite() {
Object[] compositeArg = new Object[]{this, elementCaseDesign, formDesign.getElementCaseContainer()};
HashMap<String, Class> compoClass = new HashMap<String, Class>();
compoClass.put(Constants.ARG_0, BaseJForm.class);
@ -929,7 +935,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
});
}
private void saveImage() {
protected void saveImage() {
//触发一次保存, 把缩略图保存起来
JForm.this.fireTargetModified();
//用formDesign的size是为了当报表块被拉伸时, 它对应的背景图片需要足够大才不会显示成空白

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

@ -5,7 +5,6 @@ package com.fr.design.mainframe.form;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignState;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.AllowAuthorityEditAction;
import com.fr.design.actions.ExitAuthorityEditAction;
import com.fr.design.base.mode.DesignModeContext;
@ -26,7 +25,6 @@ import com.fr.design.menu.NameSeparator;
import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef;
import com.fr.design.present.ConditionAttributesGroupPane;
import com.fr.design.fun.FormAdaptiveConfigUIProcessor;
import com.fr.design.selection.SelectableElement;
import com.fr.design.selection.Selectedable;
import com.fr.design.selection.SelectionListener;
@ -65,9 +63,8 @@ public class FormElementCaseDesigner
public FormElementCaseDesigner(T sheet, Form form) {
super(sheet);
elementCasePane = initElementCasePane(sheet, form);
this.setLayout(FRGUIPaneFactory.createBorderLayout());
elementCasePane = new FormElementCasePaneDelegate((FormElementCase) sheet, form);
elementCasePane.setSelection(getDefaultSelectElement());
this.add(elementCasePane, BorderLayout.CENTER);
elementCasePane.addTargetModifiedListener(new TargetModifiedListener() {
@ -80,6 +77,9 @@ public class FormElementCaseDesigner
}
protected FormElementCasePaneDelegate initElementCasePane(T sheet, Form form){
return new FormElementCasePaneDelegate((FormElementCase) sheet, form);
}
@Override
public void setTarget(T t) {
@ -126,10 +126,6 @@ public class FormElementCaseDesigner
*/
@Override
public BufferedImage getElementCaseImage(Dimension size) {
FormAdaptiveConfigUIProcessor adaptiveConfigUI = ExtraDesignClassManager.getInstance().getSingle(FormAdaptiveConfigUIProcessor.MARK_STRING);
if (adaptiveConfigUI != null) {
return adaptiveConfigUI.paintFormElementCaseImage(size, this.elementCasePane);
}
BufferedImage image = null;
try {
image = new java.awt.image.BufferedImage(size.width, size.height,

Loading…
Cancel
Save