diff --git a/designer-base/src/main/java/com/fr/design/fun/FormAdaptiveConfigUIProcessor.java b/designer-base/src/main/java/com/fr/design/fun/FormAdaptiveConfigUIProcessor.java index ebe0e8c3d..abd4b6808 100644 --- a/designer-base/src/main/java/com/fr/design/fun/FormAdaptiveConfigUIProcessor.java +++ b/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 diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java b/designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java index 60b34a099..1552d1b65 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java +++ b/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; } } }; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java b/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java index be9b4faa6..508be0327 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java +++ b/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(); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index 041705fb6..2fbccb1cd 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -154,6 +154,12 @@ public class JForm extends JTemplate