From 10dd3858cdde8e28497d0926f380212c43dcbaef Mon Sep 17 00:00:00 2001 From: kerry Date: Tue, 14 Apr 2020 20:01:39 +0800 Subject: [PATCH 1/5] =?UTF-8?q?KERNEL-3501=20=E5=86=B3=E7=AD=96=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=E8=87=AA=E9=80=82=E5=BA=94=E5=90=8E=E7=AB=AF=E9=87=8D?= =?UTF-8?q?=E6=9E=84=EF=BC=8C=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81=EF=BC=8C?= =?UTF-8?q?=E6=8F=90=E4=BE=9B=E5=8D=95=E5=85=83=E6=A0=BC=E5=8D=95=E4=BD=8D?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/unit/ReportLengthUNIT.java | 21 ++++++++ .../unit/ReportLengthUnitProcessor.java | 14 +++++ .../com/fr/design/unit/UnitConvertUtil.java | 42 +++++++++++++++ .../AbstracReportLengthUnitProcessor.java | 19 +++++++ .../unit/impl/AbstractReportLengthUNIT.java | 22 ++++++++ .../design/unit/impl/CMReportLengthUNIT.java | 32 +++++++++++ .../unit/impl/INCHReportLengthUNIT.java | 31 +++++++++++ .../design/unit/impl/MMReportLengthUNIT.java | 31 +++++++++++ .../design/unit/impl/PTReportLengthUNIT.java | 30 +++++++++++ .../FormWidgetDefinePaneFactoryBase.java | 7 ++- .../columnrow/ColumnRowSizingAction.java | 49 +++++------------ .../java/com/fr/design/condition/WHPane.java | 53 +++++-------------- .../grid/AbstractGridHeaderMouseHandler.java | 26 +++------ 13 files changed, 280 insertions(+), 97 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/unit/ReportLengthUNIT.java create mode 100644 designer-base/src/main/java/com/fr/design/unit/ReportLengthUnitProcessor.java create mode 100644 designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java create mode 100644 designer-base/src/main/java/com/fr/design/unit/impl/AbstracReportLengthUnitProcessor.java create mode 100644 designer-base/src/main/java/com/fr/design/unit/impl/AbstractReportLengthUNIT.java create mode 100644 designer-base/src/main/java/com/fr/design/unit/impl/CMReportLengthUNIT.java create mode 100644 designer-base/src/main/java/com/fr/design/unit/impl/INCHReportLengthUNIT.java create mode 100644 designer-base/src/main/java/com/fr/design/unit/impl/MMReportLengthUNIT.java create mode 100644 designer-base/src/main/java/com/fr/design/unit/impl/PTReportLengthUNIT.java diff --git a/designer-base/src/main/java/com/fr/design/unit/ReportLengthUNIT.java b/designer-base/src/main/java/com/fr/design/unit/ReportLengthUNIT.java new file mode 100644 index 0000000000..513232d951 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/unit/ReportLengthUNIT.java @@ -0,0 +1,21 @@ +package com.fr.design.unit; + +import com.fr.stable.fun.mark.Mutable; +import com.fr.stable.unit.UNIT; + +/** + * Created by kerry on 2020-04-09 + */ +public interface ReportLengthUNIT extends Mutable { + String MARK_STRING = "ReportLengthUNIT"; + + int CURRENT_LEVEL = 1; + + String unitText(); + + int unitType(); + + float unit2Value4Scale(UNIT value); + + UNIT float2UNIT(float value); +} diff --git a/designer-base/src/main/java/com/fr/design/unit/ReportLengthUnitProcessor.java b/designer-base/src/main/java/com/fr/design/unit/ReportLengthUnitProcessor.java new file mode 100644 index 0000000000..f496d69dba --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/unit/ReportLengthUnitProcessor.java @@ -0,0 +1,14 @@ +package com.fr.design.unit; + +import com.fr.stable.fun.mark.Immutable; + +/** + * Created by kerry on 2020-04-09 + */ +public interface ReportLengthUnitProcessor extends Immutable { + String MARK_STRING = "ReportLengthUnitProcessor"; + int CURRENT_LEVEL = 1; + + ReportLengthUNIT getReportLengthUNIT(); + +} diff --git a/designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java b/designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java new file mode 100644 index 0000000000..80d35d83b4 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java @@ -0,0 +1,42 @@ +package com.fr.design.unit; + +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.unit.impl.CMReportLengthUNIT; +import com.fr.design.unit.impl.INCHReportLengthUNIT; +import com.fr.design.unit.impl.MMReportLengthUNIT; +import com.fr.design.unit.impl.PTReportLengthUNIT; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by kerry on 2020-04-09 + */ +public class UnitConvertUtil { + private static List lengthUNITList = new ArrayList(); + + static { + lengthUNITList.add(new CMReportLengthUNIT()); + lengthUNITList.add(new INCHReportLengthUNIT()); + lengthUNITList.add(new PTReportLengthUNIT()); + lengthUNITList.add(new MMReportLengthUNIT()); + } + + private UnitConvertUtil() { + + } + + + public static ReportLengthUNIT parseLengthUNIT(int unitType) { + ReportLengthUnitProcessor lengthUnitProcessor = ExtraDesignClassManager.getInstance().getSingle(ReportLengthUnitProcessor.MARK_STRING); + if (lengthUnitProcessor != null) { + return lengthUnitProcessor.getReportLengthUNIT(); + } + for (ReportLengthUNIT lengthUNIT : lengthUNITList) { + if (unitType == lengthUNIT.unitType()) { + return lengthUNIT; + } + } + return new MMReportLengthUNIT(); + } +} diff --git a/designer-base/src/main/java/com/fr/design/unit/impl/AbstracReportLengthUnitProcessor.java b/designer-base/src/main/java/com/fr/design/unit/impl/AbstracReportLengthUnitProcessor.java new file mode 100644 index 0000000000..64242b3b3c --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/unit/impl/AbstracReportLengthUnitProcessor.java @@ -0,0 +1,19 @@ +package com.fr.design.unit.impl; + +import com.fr.design.unit.ReportLengthUnitProcessor; + +/** + * Created by kerry on 2020-04-09 + */ +public abstract class AbstracReportLengthUnitProcessor implements ReportLengthUnitProcessor { + + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public int layerIndex() { + return DEFAULT_LAYER_INDEX; + } +} diff --git a/designer-base/src/main/java/com/fr/design/unit/impl/AbstractReportLengthUNIT.java b/designer-base/src/main/java/com/fr/design/unit/impl/AbstractReportLengthUNIT.java new file mode 100644 index 0000000000..d1947b8f4e --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/unit/impl/AbstractReportLengthUNIT.java @@ -0,0 +1,22 @@ +package com.fr.design.unit.impl; + + +import com.fr.design.unit.ReportLengthUNIT; + +/** + * Created by kerry on 2020-04-09 + */ +public abstract class AbstractReportLengthUNIT implements ReportLengthUNIT { + + + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public String mark4Provider() { + return getClass().getName(); + } + +} diff --git a/designer-base/src/main/java/com/fr/design/unit/impl/CMReportLengthUNIT.java b/designer-base/src/main/java/com/fr/design/unit/impl/CMReportLengthUNIT.java new file mode 100644 index 0000000000..e3b550d018 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/unit/impl/CMReportLengthUNIT.java @@ -0,0 +1,32 @@ +package com.fr.design.unit.impl; + +import com.fr.design.unit.impl.AbstractReportLengthUNIT; +import com.fr.stable.Constants; +import com.fr.stable.unit.CM; +import com.fr.stable.unit.UNIT; + +/** + * Created by kerry on 2020-04-09 + */ +public class CMReportLengthUNIT extends AbstractReportLengthUNIT { + @Override + public String unitText() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_CM"); + } + + @Override + public int unitType() { + return Constants.UNIT_CM; + } + + @Override + public float unit2Value4Scale(UNIT value) { + return value.toCMValue4Scale2(); + } + + @Override + public UNIT float2UNIT(float value) { + return new CM(value); + } + +} diff --git a/designer-base/src/main/java/com/fr/design/unit/impl/INCHReportLengthUNIT.java b/designer-base/src/main/java/com/fr/design/unit/impl/INCHReportLengthUNIT.java new file mode 100644 index 0000000000..c919e14e14 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/unit/impl/INCHReportLengthUNIT.java @@ -0,0 +1,31 @@ +package com.fr.design.unit.impl; + +import com.fr.design.unit.impl.AbstractReportLengthUNIT; +import com.fr.stable.Constants; +import com.fr.stable.unit.INCH; +import com.fr.stable.unit.UNIT; + +/** + * Created by kerry on 2020-04-09 + */ +public class INCHReportLengthUNIT extends AbstractReportLengthUNIT { + @Override + public String unitText() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_INCH"); + } + + @Override + public int unitType() { + return Constants.UNIT_INCH; + } + + @Override + public float unit2Value4Scale(UNIT value) { + return value.toINCHValue4Scale3(); + } + + @Override + public UNIT float2UNIT(float value) { + return new INCH(value); + } +} diff --git a/designer-base/src/main/java/com/fr/design/unit/impl/MMReportLengthUNIT.java b/designer-base/src/main/java/com/fr/design/unit/impl/MMReportLengthUNIT.java new file mode 100644 index 0000000000..e6f3523ecc --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/unit/impl/MMReportLengthUNIT.java @@ -0,0 +1,31 @@ +package com.fr.design.unit.impl; + +import com.fr.design.unit.impl.AbstractReportLengthUNIT; +import com.fr.stable.Constants; +import com.fr.stable.unit.MM; +import com.fr.stable.unit.UNIT; + +/** + * Created by kerry on 2020-04-09 + */ +public class MMReportLengthUNIT extends AbstractReportLengthUNIT { + @Override + public String unitText() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_MM"); + } + + @Override + public int unitType() { + return Constants.UNIT_MM; + } + + @Override + public float unit2Value4Scale(UNIT value) { + return value.toMMValue4Scale2(); + } + + @Override + public UNIT float2UNIT(float value) { + return new MM(value); + } +} diff --git a/designer-base/src/main/java/com/fr/design/unit/impl/PTReportLengthUNIT.java b/designer-base/src/main/java/com/fr/design/unit/impl/PTReportLengthUNIT.java new file mode 100644 index 0000000000..1ab5bbedfb --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/unit/impl/PTReportLengthUNIT.java @@ -0,0 +1,30 @@ +package com.fr.design.unit.impl; + +import com.fr.stable.Constants; +import com.fr.stable.unit.PT; +import com.fr.stable.unit.UNIT; + +/** + * Created by kerry on 2020-04-09 + */ +public class PTReportLengthUNIT extends AbstractReportLengthUNIT { + @Override + public String unitText() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_PT_Duplicate"); + } + + @Override + public int unitType() { + return Constants.UNIT_PT; + } + + @Override + public float unit2Value4Scale(UNIT value) { + return value.toPTValue4Scale2(); + } + + @Override + public UNIT float2UNIT(float value) { + return new PT(value); + } +} diff --git a/designer-form/src/main/java/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java b/designer-form/src/main/java/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java index 9df0a32012..1947e9ec4e 100644 --- a/designer-form/src/main/java/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java +++ b/designer-form/src/main/java/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java @@ -127,6 +127,11 @@ public class FormWidgetDefinePaneFactoryBase { } + + public static void registerDefinePane(Class widget, Appearance appearance) { + defineMap.put(widget, appearance); + } + public static RN createWidgetDefinePane(XCreator creator, FormDesigner designer, Widget widget, Operator operator) { if (isExtraXWidget(widget)) { WidgetDefinePane widgetDefinePane = new WidgetDefinePane(creator, designer); @@ -165,4 +170,4 @@ public class FormWidgetDefinePaneFactoryBase { } } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/columnrow/ColumnRowSizingAction.java b/designer-realize/src/main/java/com/fr/design/actions/columnrow/ColumnRowSizingAction.java index c9cc9e1b59..b14d1945b7 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/columnrow/ColumnRowSizingAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/columnrow/ColumnRowSizingAction.java @@ -10,14 +10,11 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.mainframe.ElementCasePane; +import com.fr.design.unit.ReportLengthUNIT; +import com.fr.design.unit.UnitConvertUtil; import com.fr.grid.selection.CellSelection; import com.fr.report.elementcase.ElementCase; import com.fr.stable.ArrayUtils; -import com.fr.stable.Constants; -import com.fr.stable.unit.CM; -import com.fr.stable.unit.INCH; -import com.fr.stable.unit.MM; -import com.fr.stable.unit.PT; import com.fr.stable.unit.UNIT; /** @@ -28,7 +25,7 @@ public abstract class ColumnRowSizingAction extends AbstractColumnRowIndexAction protected ColumnRowSizingAction(ElementCasePane t, int indexOfColumnOrRow) { super(t, indexOfColumnOrRow); } - + @Override protected boolean executeActionReturnUndoRecordNeededWithCellSelection( CellSelection cs) { @@ -43,7 +40,7 @@ public abstract class ColumnRowSizingAction extends AbstractColumnRowIndexAction }; UNIT len = getShowLen(report, cs); populateNumberDialog(uPane, len); - + final CellSelection finalCS = cs; uPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { @@ -52,21 +49,13 @@ public abstract class ColumnRowSizingAction extends AbstractColumnRowIndexAction try { float newHeight = (float) uPane.update(); int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit(); - UNIT len; - if (unitType == Constants.UNIT_CM) { - len = new CM(newHeight); - } else if (unitType == Constants.UNIT_INCH) { - len = new INCH(newHeight); - } else if (unitType == Constants.UNIT_PT) { - len = new PT(newHeight); - } else { - len = new MM(newHeight); - } + ReportLengthUNIT lengthUNIT = UnitConvertUtil.parseLengthUNIT(unitType); + UNIT len = lengthUNIT.float2UNIT(newHeight); updateAction(report, len, finalCS); } catch (ValueNotChangeException e) { // nothing } - + ePane.fireTargetModified(); } }).setVisible(true); @@ -75,28 +64,16 @@ public abstract class ColumnRowSizingAction extends AbstractColumnRowIndexAction protected void populateNumberDialog(final UnitInputPane uPane, UNIT unit) { int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit(); - float va; - if (unitType == Constants.UNIT_CM) { - va = unit.toCMValue4Scale2(); - uPane.setUnitText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_CM")); - } else if (unitType == Constants.UNIT_INCH) { - va = unit.toINCHValue4Scale3(); - uPane.setUnitText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_INCH")); - } else if (unitType == Constants.UNIT_PT) { - va = unit.toPTValue4Scale2(); - uPane.setUnitText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_PT")); - } else { - va = unit.toMMValue4Scale2(); - uPane.setUnitText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_MM")); - } - + ReportLengthUNIT lengthUNIT = UnitConvertUtil.parseLengthUNIT(unitType); + float va = lengthUNIT.unit2Value4Scale(unit); + uPane.setUnitText(lengthUNIT.unitText()); uPane.populate(va); } - + protected abstract String title4UnitInputPane(); - + protected abstract void updateAction(ElementCase report, UNIT len, CellSelection cs); - + protected abstract UNIT getShowLen(ElementCase report, CellSelection cs); protected abstract UNIT getIndexLen(int index, ElementCase report); diff --git a/designer-realize/src/main/java/com/fr/design/condition/WHPane.java b/designer-realize/src/main/java/com/fr/design/condition/WHPane.java index dce2d466ad..ed8eea8541 100644 --- a/designer-realize/src/main/java/com/fr/design/condition/WHPane.java +++ b/designer-realize/src/main/java/com/fr/design/condition/WHPane.java @@ -3,17 +3,16 @@ package com.fr.design.condition; import com.fr.design.DesignerEnvManager; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UIBasicSpinner; +import com.fr.design.unit.ReportLengthUNIT; +import com.fr.design.unit.UnitConvertUtil; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.report.cell.cellattr.highlight.HighlightAction; -import com.fr.stable.Constants; -import com.fr.stable.unit.*; +import com.fr.stable.unit.UNIT; -import javax.swing.*; -import java.awt.event.FocusAdapter; -import java.awt.event.FocusEvent; +import javax.swing.JSpinner; +import javax.swing.SpinnerNumberModel; import java.math.BigDecimal; -import java.text.ParseException; /** * @author richie @@ -45,23 +44,12 @@ public abstract class WHPane extends ConditionAttrSingleConditionPane Date: Wed, 15 Apr 2020 11:45:12 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AbstractFormAdaptiveConfigUI.java | 18 +++++++++++++ .../fit/menupane/FormAdaptiveConfigUI.java | 26 +++++++++++++++++++ .../fit/menupane/ReportFitAttrAction.java | 15 +++++++++-- .../unit/ReportLengthUnitProcessor.java | 2 +- .../com/fr/design/unit/UnitConvertUtil.java | 2 +- .../form/FormElementCaseDesigner.java | 8 +++++- 6 files changed, 66 insertions(+), 5 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/report/fit/menupane/AbstractFormAdaptiveConfigUI.java create mode 100644 designer-base/src/main/java/com/fr/design/report/fit/menupane/FormAdaptiveConfigUI.java diff --git a/designer-base/src/main/java/com/fr/design/report/fit/menupane/AbstractFormAdaptiveConfigUI.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/AbstractFormAdaptiveConfigUI.java new file mode 100644 index 0000000000..bf0822104e --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/report/fit/menupane/AbstractFormAdaptiveConfigUI.java @@ -0,0 +1,18 @@ +package com.fr.design.report.fit.menupane; + + +/** + * Created by kerry on 2020-04-09 + */ +public abstract class AbstractFormAdaptiveConfigUI implements FormAdaptiveConfigUI { + + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public int layerIndex() { + return DEFAULT_LAYER_INDEX; + } +} diff --git a/designer-base/src/main/java/com/fr/design/report/fit/menupane/FormAdaptiveConfigUI.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/FormAdaptiveConfigUI.java new file mode 100644 index 0000000000..cd88ec4ece --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/report/fit/menupane/FormAdaptiveConfigUI.java @@ -0,0 +1,26 @@ +package com.fr.design.report.fit.menupane; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.stable.fun.mark.Immutable; + +import javax.swing.JComponent; +import java.awt.Dimension; +import java.awt.image.BufferedImage; + + +/** + * Created by kerry on 2020-04-09 + */ +public interface FormAdaptiveConfigUI extends Immutable { + + String MARK_STRING = "FormAdaptiveConfigUI"; + int CURRENT_LEVEL = 1; + + + BasicBeanPane getConfigPane(); + + BufferedImage getElementCaseImage(Dimension size, JComponent elementCasePane); + + +} + diff --git a/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java index 29a8a7deb6..ebffc98095 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java @@ -1,5 +1,6 @@ package com.fr.design.report.fit.menupane; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.JTemplateAction; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.DialogActionAdapter; @@ -42,6 +43,10 @@ public class ReportFitAttrAction extends JTemplateAction { @Override public String getMenuName() { + FormAdaptiveConfigUI configPane = ExtraDesignClassManager.getInstance().getSingle(FormAdaptiveConfigUI.MARK_STRING); + if (configPane != null) { + return configPane.getConfigPane().getTitle(); + } return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Elementcase"); } @@ -85,7 +90,13 @@ public class ReportFitAttrAction extends JTemplateAction { final TemplateFitAttrPane attrPane = new TemplateFitAttrPane(); showReportFitDialog(fitAttr, jwb, wbTpl, attrPane); } else { - final ReportFitAttrPane attrPane = new ReportFitAttrPane(); + BasicBeanPane attrPane = null; + FormAdaptiveConfigUI configPane = ExtraDesignClassManager.getInstance().getSingle(FormAdaptiveConfigUI.MARK_STRING); + if (configPane != null) { + attrPane = configPane.getConfigPane(); + }else{ + attrPane = new ReportFitAttrPane(); + } showReportFitDialog(fitAttr, jwb, wbTpl, attrPane); } } @@ -102,4 +113,4 @@ public class ReportFitAttrAction extends JTemplateAction { dialog.setVisible(true); } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/unit/ReportLengthUnitProcessor.java b/designer-base/src/main/java/com/fr/design/unit/ReportLengthUnitProcessor.java index f496d69dba..4adffd28c9 100644 --- a/designer-base/src/main/java/com/fr/design/unit/ReportLengthUnitProcessor.java +++ b/designer-base/src/main/java/com/fr/design/unit/ReportLengthUnitProcessor.java @@ -9,6 +9,6 @@ public interface ReportLengthUnitProcessor extends Immutable { String MARK_STRING = "ReportLengthUnitProcessor"; int CURRENT_LEVEL = 1; - ReportLengthUNIT getReportLengthUNIT(); + ReportLengthUNIT getReportLengthUNIT(int unitType); } diff --git a/designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java b/designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java index 80d35d83b4..fee1cccd78 100644 --- a/designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java +++ b/designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java @@ -30,7 +30,7 @@ public class UnitConvertUtil { public static ReportLengthUNIT parseLengthUNIT(int unitType) { ReportLengthUnitProcessor lengthUnitProcessor = ExtraDesignClassManager.getInstance().getSingle(ReportLengthUnitProcessor.MARK_STRING); if (lengthUnitProcessor != null) { - return lengthUnitProcessor.getReportLengthUNIT(); + return lengthUnitProcessor.getReportLengthUNIT(unitType); } for (ReportLengthUNIT lengthUNIT : lengthUNITList) { if (unitType == lengthUNIT.unitType()) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java b/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java index 07954c796e..ae4221dcec 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java @@ -5,6 +5,7 @@ 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; @@ -25,6 +26,7 @@ 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.report.fit.menupane.FormAdaptiveConfigUI; import com.fr.design.selection.SelectableElement; import com.fr.design.selection.Selectedable; import com.fr.design.selection.SelectionListener; @@ -123,6 +125,10 @@ public class FormElementCaseDesigner */ @Override public BufferedImage getElementCaseImage(Dimension size) { + FormAdaptiveConfigUI adaptiveConfigUI = ExtraDesignClassManager.getInstance().getSingle(FormAdaptiveConfigUI.MARK_STRING); + if (adaptiveConfigUI != null) { + return adaptiveConfigUI.getElementCaseImage(size, this.elementCasePane); + } BufferedImage image = null; try { image = new java.awt.image.BufferedImage(size.width, size.height, @@ -351,4 +357,4 @@ public class FormElementCaseDesigner public FormElementCaseProvider getEditingElementCase() { return this.getEditingElementCasePane().getTarget(); } -} \ No newline at end of file +} From 06e18697dc73e6e2c59453e90166693cb334909c Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 16 Apr 2020 19:49:24 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/file/PreferencePane.java | 3 +- .../fun/FormAdaptiveConfigUIProcessor.java | 35 ++++++++++++++++ .../design/fun/ReportLengthUNITProvider.java | 39 ++++++++++++++++++ ...AbstractFormAdaptiveConfigUIProcessor.java | 38 +++++++++++++++++ .../AbstractReportLengthUNITProvider.java | 41 +++++++++++++++++++ .../AbstractFormAdaptiveConfigUI.java | 18 -------- .../fit/menupane/FormAdaptiveConfigUI.java | 26 ------------ .../fit/menupane/ReportFitAttrAction.java | 5 ++- .../com/fr/design/unit/ReportLengthUNIT.java | 21 ---------- .../unit/ReportLengthUnitProcessor.java | 14 ------- .../com/fr/design/unit/UnitConvertUtil.java | 26 ++++++++---- .../AbstracReportLengthUnitProcessor.java | 19 --------- .../unit/impl/AbstractReportLengthUNIT.java | 22 ---------- .../design/unit/impl/CMReportLengthUNIT.java | 4 +- .../unit/impl/INCHReportLengthUNIT.java | 4 +- .../design/unit/impl/MMReportLengthUNIT.java | 4 +- .../design/unit/impl/PTReportLengthUNIT.java | 3 +- .../columnrow/ColumnRowSizingAction.java | 7 ++-- .../java/com/fr/design/condition/WHPane.java | 8 ++-- .../form/FormElementCaseDesigner.java | 7 ++-- .../grid/AbstractGridHeaderMouseHandler.java | 4 +- 21 files changed, 198 insertions(+), 150 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/fun/FormAdaptiveConfigUIProcessor.java create mode 100644 designer-base/src/main/java/com/fr/design/fun/ReportLengthUNITProvider.java create mode 100644 designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormAdaptiveConfigUIProcessor.java create mode 100644 designer-base/src/main/java/com/fr/design/fun/impl/AbstractReportLengthUNITProvider.java delete mode 100644 designer-base/src/main/java/com/fr/design/report/fit/menupane/AbstractFormAdaptiveConfigUI.java delete mode 100644 designer-base/src/main/java/com/fr/design/report/fit/menupane/FormAdaptiveConfigUI.java delete mode 100644 designer-base/src/main/java/com/fr/design/unit/ReportLengthUNIT.java delete mode 100644 designer-base/src/main/java/com/fr/design/unit/ReportLengthUnitProcessor.java delete mode 100644 designer-base/src/main/java/com/fr/design/unit/impl/AbstracReportLengthUnitProcessor.java delete mode 100644 designer-base/src/main/java/com/fr/design/unit/impl/AbstractReportLengthUNIT.java diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index 8f88cdeff0..387082ed05 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -28,6 +28,7 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.vcs.VcsConfigManager; import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.design.os.impl.SupportOSImpl; +import com.fr.design.unit.UnitConvertUtil; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.widget.FRWidgetFactory; import com.fr.general.ComparatorUtils; @@ -575,7 +576,7 @@ public class PreferencePane extends BasicPane { pageLengthComboBox = new UIComboBox(new String[]{i18nText("Fine-Design_Basic_Page_Setup_MM"), i18nText("Fine-Design_Report_Unit_CM"), i18nText("Fine-Design_Report_Unit_INCH")}); pageLengthComboBox.setPreferredSize(new Dimension(80, 20)); pageLengthComboBox.setMinimumSize(new Dimension(80, 20)); - reportLengthComboBox = new UIComboBox(new String[]{i18nText("Fine-Design_Basic_Page_Setup_MM"), i18nText("Fine-Design_Report_Unit_CM"), i18nText("Fine-Design_Report_Unit_INCH"), i18nText("Fine-Design_Report_Unit_PT_Duplicate")}); + reportLengthComboBox = new UIComboBox(UnitConvertUtil.getUnitItems()); reportLengthComboBox.setPreferredSize(new Dimension(80, 20)); reportLengthComboBox.setMinimumSize(new Dimension(80, 20)); UILabel pagelengthLabel = new UILabel(i18nText("Fine-Design_Basic_Page_Setup_Scale_Units") + ":"); 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 new file mode 100644 index 0000000000..a91e202c9f --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/FormAdaptiveConfigUIProcessor.java @@ -0,0 +1,35 @@ +package com.fr.design.fun; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.stable.fun.mark.Immutable; + +import javax.swing.JComponent; +import java.awt.Dimension; +import java.awt.image.BufferedImage; + + +/** + * Created by kerry on 2020-04-09 + * 临时接口,后续自适应内置后删除 + */ +public interface FormAdaptiveConfigUIProcessor extends Immutable { + + String MARK_STRING = "FormAdaptiveConfigUI"; + int CURRENT_LEVEL = 1; + + /** + * 获取表单自适应配置界面 + * @return 表单自适应配置界面 + */ + BasicBeanPane getConfigPane(); + + /** + * 绘制自适应下报表块在表单界面中显示图片 + * @param size 绘制尺寸 + * @param elementCasePane 报表块内容对象 + * @return 自适应下报表块在表单界面中显示的图片 + */ + BufferedImage paintFormElementCaseImage(Dimension size, JComponent elementCasePane); + +} + diff --git a/designer-base/src/main/java/com/fr/design/fun/ReportLengthUNITProvider.java b/designer-base/src/main/java/com/fr/design/fun/ReportLengthUNITProvider.java new file mode 100644 index 0000000000..af97950cf8 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/ReportLengthUNITProvider.java @@ -0,0 +1,39 @@ +package com.fr.design.fun; + +import com.fr.stable.fun.mark.Mutable; +import com.fr.stable.unit.UNIT; + +/** + * Created by kerry on 2020-04-09 + */ +public interface ReportLengthUNITProvider extends Mutable { + String MARK_STRING = "ReportLengthUNITProvider"; + + int CURRENT_LEVEL = 1; + + /** + * 标尺单位显示字符 + * @return 标尺单位字符 + */ + String unitText(); + + /** + * 标尺单位类型(之前是将int类型的值直接保存在数据库里面的) + * @return 返回标尺单位类型 + */ + int unitType(); + + /** + * UNIT转标尺单位值 + * @param value UNIT + * @return 标尺单位值 + */ + float unit2Value4Scale(UNIT value); + + /** + * 标尺单位值转UNIT + * @param value 标尺单位值 + * @return UNIT + */ + UNIT float2UNIT(float value); +} diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormAdaptiveConfigUIProcessor.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormAdaptiveConfigUIProcessor.java new file mode 100644 index 0000000000..e573339875 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormAdaptiveConfigUIProcessor.java @@ -0,0 +1,38 @@ +package com.fr.design.fun.impl; + + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.fun.FormAdaptiveConfigUIProcessor; +import com.fr.stable.fun.impl.AbstractProvider; +import com.fr.stable.fun.mark.API; + +import javax.swing.JComponent; +import java.awt.Dimension; +import java.awt.image.BufferedImage; + +/** + * Created by kerry on 2020-04-09 + */ +@API(level = FormAdaptiveConfigUIProcessor.CURRENT_LEVEL) +public abstract class AbstractFormAdaptiveConfigUIProcessor extends AbstractProvider implements FormAdaptiveConfigUIProcessor { + + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public int layerIndex() { + return DEFAULT_LAYER_INDEX; + } + + @Override + public BasicBeanPane getConfigPane() { + return null; + } + + @Override + public BufferedImage paintFormElementCaseImage(Dimension size, JComponent elementCasePane) { + return null; + } +} diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractReportLengthUNITProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractReportLengthUNITProvider.java new file mode 100644 index 0000000000..b550b07c1e --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractReportLengthUNITProvider.java @@ -0,0 +1,41 @@ +package com.fr.design.fun.impl; + + +import com.fr.design.fun.ReportLengthUNITProvider; +import com.fr.stable.StringUtils; +import com.fr.stable.fun.impl.AbstractProvider; +import com.fr.stable.fun.mark.API; +import com.fr.stable.unit.UNIT; + +/** + * Created by kerry on 2020-04-09 + */ +@API(level = ReportLengthUNITProvider.CURRENT_LEVEL) +public abstract class AbstractReportLengthUNITProvider extends AbstractProvider implements ReportLengthUNITProvider { + + + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public String unitText() { + return StringUtils.EMPTY; + } + + @Override + public int unitType() { + return 0; + } + + @Override + public float unit2Value4Scale(UNIT value) { + return 0; + } + + @Override + public UNIT float2UNIT(float value) { + return null; + } +} diff --git a/designer-base/src/main/java/com/fr/design/report/fit/menupane/AbstractFormAdaptiveConfigUI.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/AbstractFormAdaptiveConfigUI.java deleted file mode 100644 index bf0822104e..0000000000 --- a/designer-base/src/main/java/com/fr/design/report/fit/menupane/AbstractFormAdaptiveConfigUI.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.fr.design.report.fit.menupane; - - -/** - * Created by kerry on 2020-04-09 - */ -public abstract class AbstractFormAdaptiveConfigUI implements FormAdaptiveConfigUI { - - @Override - public int currentAPILevel() { - return CURRENT_LEVEL; - } - - @Override - public int layerIndex() { - return DEFAULT_LAYER_INDEX; - } -} diff --git a/designer-base/src/main/java/com/fr/design/report/fit/menupane/FormAdaptiveConfigUI.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/FormAdaptiveConfigUI.java deleted file mode 100644 index cd88ec4ece..0000000000 --- a/designer-base/src/main/java/com/fr/design/report/fit/menupane/FormAdaptiveConfigUI.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.fr.design.report.fit.menupane; - -import com.fr.design.beans.BasicBeanPane; -import com.fr.stable.fun.mark.Immutable; - -import javax.swing.JComponent; -import java.awt.Dimension; -import java.awt.image.BufferedImage; - - -/** - * Created by kerry on 2020-04-09 - */ -public interface FormAdaptiveConfigUI extends Immutable { - - String MARK_STRING = "FormAdaptiveConfigUI"; - int CURRENT_LEVEL = 1; - - - BasicBeanPane getConfigPane(); - - BufferedImage getElementCaseImage(Dimension size, JComponent elementCasePane); - - -} - diff --git a/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java index ebffc98095..bbf5106c35 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java @@ -5,6 +5,7 @@ import com.fr.design.actions.JTemplateAction; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.UIDialog; +import com.fr.design.fun.FormAdaptiveConfigUIProcessor; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.design.menu.MenuKeySet; @@ -43,7 +44,7 @@ public class ReportFitAttrAction extends JTemplateAction { @Override public String getMenuName() { - FormAdaptiveConfigUI configPane = ExtraDesignClassManager.getInstance().getSingle(FormAdaptiveConfigUI.MARK_STRING); + FormAdaptiveConfigUIProcessor configPane = ExtraDesignClassManager.getInstance().getSingle(FormAdaptiveConfigUIProcessor.MARK_STRING); if (configPane != null) { return configPane.getConfigPane().getTitle(); } @@ -91,7 +92,7 @@ public class ReportFitAttrAction extends JTemplateAction { showReportFitDialog(fitAttr, jwb, wbTpl, attrPane); } else { BasicBeanPane attrPane = null; - FormAdaptiveConfigUI configPane = ExtraDesignClassManager.getInstance().getSingle(FormAdaptiveConfigUI.MARK_STRING); + FormAdaptiveConfigUIProcessor configPane = ExtraDesignClassManager.getInstance().getSingle(FormAdaptiveConfigUIProcessor.MARK_STRING); if (configPane != null) { attrPane = configPane.getConfigPane(); }else{ diff --git a/designer-base/src/main/java/com/fr/design/unit/ReportLengthUNIT.java b/designer-base/src/main/java/com/fr/design/unit/ReportLengthUNIT.java deleted file mode 100644 index 513232d951..0000000000 --- a/designer-base/src/main/java/com/fr/design/unit/ReportLengthUNIT.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.fr.design.unit; - -import com.fr.stable.fun.mark.Mutable; -import com.fr.stable.unit.UNIT; - -/** - * Created by kerry on 2020-04-09 - */ -public interface ReportLengthUNIT extends Mutable { - String MARK_STRING = "ReportLengthUNIT"; - - int CURRENT_LEVEL = 1; - - String unitText(); - - int unitType(); - - float unit2Value4Scale(UNIT value); - - UNIT float2UNIT(float value); -} diff --git a/designer-base/src/main/java/com/fr/design/unit/ReportLengthUnitProcessor.java b/designer-base/src/main/java/com/fr/design/unit/ReportLengthUnitProcessor.java deleted file mode 100644 index 4adffd28c9..0000000000 --- a/designer-base/src/main/java/com/fr/design/unit/ReportLengthUnitProcessor.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.fr.design.unit; - -import com.fr.stable.fun.mark.Immutable; - -/** - * Created by kerry on 2020-04-09 - */ -public interface ReportLengthUnitProcessor extends Immutable { - String MARK_STRING = "ReportLengthUnitProcessor"; - int CURRENT_LEVEL = 1; - - ReportLengthUNIT getReportLengthUNIT(int unitType); - -} diff --git a/designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java b/designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java index fee1cccd78..406ddcfdde 100644 --- a/designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java +++ b/designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java @@ -1,6 +1,7 @@ package com.fr.design.unit; import com.fr.design.ExtraDesignClassManager; +import com.fr.design.fun.ReportLengthUNITProvider; import com.fr.design.unit.impl.CMReportLengthUNIT; import com.fr.design.unit.impl.INCHReportLengthUNIT; import com.fr.design.unit.impl.MMReportLengthUNIT; @@ -8,18 +9,23 @@ import com.fr.design.unit.impl.PTReportLengthUNIT; import java.util.ArrayList; import java.util.List; +import java.util.Set; /** * Created by kerry on 2020-04-09 */ public class UnitConvertUtil { - private static List lengthUNITList = new ArrayList(); + private static List lengthUNITList = new ArrayList(); static { + lengthUNITList.add(new MMReportLengthUNIT()); lengthUNITList.add(new CMReportLengthUNIT()); lengthUNITList.add(new INCHReportLengthUNIT()); lengthUNITList.add(new PTReportLengthUNIT()); - lengthUNITList.add(new MMReportLengthUNIT()); + Set providers = ExtraDesignClassManager.getInstance().getArray(ReportLengthUNITProvider.MARK_STRING); + for (ReportLengthUNITProvider provider : providers) { + lengthUNITList.add(provider); + } } private UnitConvertUtil() { @@ -27,16 +33,20 @@ public class UnitConvertUtil { } - public static ReportLengthUNIT parseLengthUNIT(int unitType) { - ReportLengthUnitProcessor lengthUnitProcessor = ExtraDesignClassManager.getInstance().getSingle(ReportLengthUnitProcessor.MARK_STRING); - if (lengthUnitProcessor != null) { - return lengthUnitProcessor.getReportLengthUNIT(unitType); - } - for (ReportLengthUNIT lengthUNIT : lengthUNITList) { + public static ReportLengthUNITProvider parseLengthUNIT(int unitType) { + for (ReportLengthUNITProvider lengthUNIT : lengthUNITList) { if (unitType == lengthUNIT.unitType()) { return lengthUNIT; } } return new MMReportLengthUNIT(); } + + public static String[] getUnitItems() { + String[] unitItems = new String[lengthUNITList.size()]; + for (int i = 0; i < lengthUNITList.size(); i++) { + unitItems[i] = lengthUNITList.get(i).unitText(); + } + return unitItems; + } } diff --git a/designer-base/src/main/java/com/fr/design/unit/impl/AbstracReportLengthUnitProcessor.java b/designer-base/src/main/java/com/fr/design/unit/impl/AbstracReportLengthUnitProcessor.java deleted file mode 100644 index 64242b3b3c..0000000000 --- a/designer-base/src/main/java/com/fr/design/unit/impl/AbstracReportLengthUnitProcessor.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.fr.design.unit.impl; - -import com.fr.design.unit.ReportLengthUnitProcessor; - -/** - * Created by kerry on 2020-04-09 - */ -public abstract class AbstracReportLengthUnitProcessor implements ReportLengthUnitProcessor { - - @Override - public int currentAPILevel() { - return CURRENT_LEVEL; - } - - @Override - public int layerIndex() { - return DEFAULT_LAYER_INDEX; - } -} diff --git a/designer-base/src/main/java/com/fr/design/unit/impl/AbstractReportLengthUNIT.java b/designer-base/src/main/java/com/fr/design/unit/impl/AbstractReportLengthUNIT.java deleted file mode 100644 index d1947b8f4e..0000000000 --- a/designer-base/src/main/java/com/fr/design/unit/impl/AbstractReportLengthUNIT.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.fr.design.unit.impl; - - -import com.fr.design.unit.ReportLengthUNIT; - -/** - * Created by kerry on 2020-04-09 - */ -public abstract class AbstractReportLengthUNIT implements ReportLengthUNIT { - - - @Override - public int currentAPILevel() { - return CURRENT_LEVEL; - } - - @Override - public String mark4Provider() { - return getClass().getName(); - } - -} diff --git a/designer-base/src/main/java/com/fr/design/unit/impl/CMReportLengthUNIT.java b/designer-base/src/main/java/com/fr/design/unit/impl/CMReportLengthUNIT.java index e3b550d018..ef4dcb64af 100644 --- a/designer-base/src/main/java/com/fr/design/unit/impl/CMReportLengthUNIT.java +++ b/designer-base/src/main/java/com/fr/design/unit/impl/CMReportLengthUNIT.java @@ -1,6 +1,6 @@ package com.fr.design.unit.impl; -import com.fr.design.unit.impl.AbstractReportLengthUNIT; +import com.fr.design.fun.impl.AbstractReportLengthUNITProvider; import com.fr.stable.Constants; import com.fr.stable.unit.CM; import com.fr.stable.unit.UNIT; @@ -8,7 +8,7 @@ import com.fr.stable.unit.UNIT; /** * Created by kerry on 2020-04-09 */ -public class CMReportLengthUNIT extends AbstractReportLengthUNIT { +public class CMReportLengthUNIT extends AbstractReportLengthUNITProvider { @Override public String unitText() { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_CM"); diff --git a/designer-base/src/main/java/com/fr/design/unit/impl/INCHReportLengthUNIT.java b/designer-base/src/main/java/com/fr/design/unit/impl/INCHReportLengthUNIT.java index c919e14e14..5cfcb6920f 100644 --- a/designer-base/src/main/java/com/fr/design/unit/impl/INCHReportLengthUNIT.java +++ b/designer-base/src/main/java/com/fr/design/unit/impl/INCHReportLengthUNIT.java @@ -1,6 +1,6 @@ package com.fr.design.unit.impl; -import com.fr.design.unit.impl.AbstractReportLengthUNIT; +import com.fr.design.fun.impl.AbstractReportLengthUNITProvider; import com.fr.stable.Constants; import com.fr.stable.unit.INCH; import com.fr.stable.unit.UNIT; @@ -8,7 +8,7 @@ import com.fr.stable.unit.UNIT; /** * Created by kerry on 2020-04-09 */ -public class INCHReportLengthUNIT extends AbstractReportLengthUNIT { +public class INCHReportLengthUNIT extends AbstractReportLengthUNITProvider { @Override public String unitText() { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_INCH"); diff --git a/designer-base/src/main/java/com/fr/design/unit/impl/MMReportLengthUNIT.java b/designer-base/src/main/java/com/fr/design/unit/impl/MMReportLengthUNIT.java index e6f3523ecc..a4bc2bacaa 100644 --- a/designer-base/src/main/java/com/fr/design/unit/impl/MMReportLengthUNIT.java +++ b/designer-base/src/main/java/com/fr/design/unit/impl/MMReportLengthUNIT.java @@ -1,6 +1,6 @@ package com.fr.design.unit.impl; -import com.fr.design.unit.impl.AbstractReportLengthUNIT; +import com.fr.design.fun.impl.AbstractReportLengthUNITProvider; import com.fr.stable.Constants; import com.fr.stable.unit.MM; import com.fr.stable.unit.UNIT; @@ -8,7 +8,7 @@ import com.fr.stable.unit.UNIT; /** * Created by kerry on 2020-04-09 */ -public class MMReportLengthUNIT extends AbstractReportLengthUNIT { +public class MMReportLengthUNIT extends AbstractReportLengthUNITProvider { @Override public String unitText() { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_MM"); diff --git a/designer-base/src/main/java/com/fr/design/unit/impl/PTReportLengthUNIT.java b/designer-base/src/main/java/com/fr/design/unit/impl/PTReportLengthUNIT.java index 1ab5bbedfb..9be7a8778a 100644 --- a/designer-base/src/main/java/com/fr/design/unit/impl/PTReportLengthUNIT.java +++ b/designer-base/src/main/java/com/fr/design/unit/impl/PTReportLengthUNIT.java @@ -1,5 +1,6 @@ package com.fr.design.unit.impl; +import com.fr.design.fun.impl.AbstractReportLengthUNITProvider; import com.fr.stable.Constants; import com.fr.stable.unit.PT; import com.fr.stable.unit.UNIT; @@ -7,7 +8,7 @@ import com.fr.stable.unit.UNIT; /** * Created by kerry on 2020-04-09 */ -public class PTReportLengthUNIT extends AbstractReportLengthUNIT { +public class PTReportLengthUNIT extends AbstractReportLengthUNITProvider { @Override public String unitText() { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_PT_Duplicate"); diff --git a/designer-realize/src/main/java/com/fr/design/actions/columnrow/ColumnRowSizingAction.java b/designer-realize/src/main/java/com/fr/design/actions/columnrow/ColumnRowSizingAction.java index b14d1945b7..f7e86d2c03 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/columnrow/ColumnRowSizingAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/columnrow/ColumnRowSizingAction.java @@ -4,13 +4,14 @@ package com.fr.design.actions.columnrow; import com.fr.design.DesignerEnvManager; +import com.fr.design.fun.ReportLengthUNITProvider; import com.fr.design.gui.frpane.UnitInputPane; import com.fr.design.gui.frpane.UnitInputPane.ValueNotChangeException; import com.fr.design.mainframe.DesignerContext; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.mainframe.ElementCasePane; -import com.fr.design.unit.ReportLengthUNIT; +import com.fr.design.fun.ReportLengthUNITProvider; import com.fr.design.unit.UnitConvertUtil; import com.fr.grid.selection.CellSelection; import com.fr.report.elementcase.ElementCase; @@ -49,7 +50,7 @@ public abstract class ColumnRowSizingAction extends AbstractColumnRowIndexAction try { float newHeight = (float) uPane.update(); int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit(); - ReportLengthUNIT lengthUNIT = UnitConvertUtil.parseLengthUNIT(unitType); + ReportLengthUNITProvider lengthUNIT = UnitConvertUtil.parseLengthUNIT(unitType); UNIT len = lengthUNIT.float2UNIT(newHeight); updateAction(report, len, finalCS); } catch (ValueNotChangeException e) { @@ -64,7 +65,7 @@ public abstract class ColumnRowSizingAction extends AbstractColumnRowIndexAction protected void populateNumberDialog(final UnitInputPane uPane, UNIT unit) { int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit(); - ReportLengthUNIT lengthUNIT = UnitConvertUtil.parseLengthUNIT(unitType); + ReportLengthUNITProvider lengthUNIT = UnitConvertUtil.parseLengthUNIT(unitType); float va = lengthUNIT.unit2Value4Scale(unit); uPane.setUnitText(lengthUNIT.unitText()); uPane.populate(va); diff --git a/designer-realize/src/main/java/com/fr/design/condition/WHPane.java b/designer-realize/src/main/java/com/fr/design/condition/WHPane.java index ed8eea8541..7b4f636a64 100644 --- a/designer-realize/src/main/java/com/fr/design/condition/WHPane.java +++ b/designer-realize/src/main/java/com/fr/design/condition/WHPane.java @@ -3,7 +3,7 @@ package com.fr.design.condition; import com.fr.design.DesignerEnvManager; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UIBasicSpinner; -import com.fr.design.unit.ReportLengthUNIT; +import com.fr.design.fun.ReportLengthUNITProvider; import com.fr.design.unit.UnitConvertUtil; import com.fr.design.utils.gui.GUICoreUtils; @@ -47,7 +47,7 @@ public abstract class WHPane extends ConditionAttrSingleConditionPane Date: Fri, 17 Apr 2020 10:28:17 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/fun/impl/AbstractReportLengthUNITProvider.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractReportLengthUNITProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractReportLengthUNITProvider.java index b550b07c1e..da77c947f9 100644 --- a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractReportLengthUNITProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractReportLengthUNITProvider.java @@ -36,6 +36,7 @@ public abstract class AbstractReportLengthUNITProvider extends AbstractProvider @Override public UNIT float2UNIT(float value) { - return null; + return UNIT.ZERO; } } + From 434692b6801f997b5867ea5a9341c82bb95565c5 Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 17 Apr 2020 10:54:24 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fun/FormAdaptiveConfigUIProcessor.java | 11 +++--- ...AbstractFormAdaptiveConfigUIProcessor.java | 17 +--------- .../fit/menupane/ReportFitAttrAction.java | 14 +------- .../java/com/fr/design/mainframe/JForm.java | 34 ++++++++++++------- 4 files changed, 30 insertions(+), 46 deletions(-) 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 a91e202c9f..1f2853b91d 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 @@ -1,6 +1,7 @@ package com.fr.design.fun; -import com.fr.design.beans.BasicBeanPane; +import com.fr.design.mainframe.JTemplate; +import com.fr.design.menu.ShortCut; import com.fr.stable.fun.mark.Immutable; import javax.swing.JComponent; @@ -14,14 +15,14 @@ import java.awt.image.BufferedImage; */ public interface FormAdaptiveConfigUIProcessor extends Immutable { - String MARK_STRING = "FormAdaptiveConfigUI"; + String MARK_STRING = "FormAdaptiveConfigUIProcessor"; int CURRENT_LEVEL = 1; /** - * 获取表单自适应配置界面 - * @return 表单自适应配置界面 + * 获取表单自适应配置菜单 + * @return 表单自适应配置菜单 */ - BasicBeanPane getConfigPane(); + ShortCut getConfigShortCut(JTemplate jTemplate); /** * 绘制自适应下报表块在表单界面中显示图片 diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormAdaptiveConfigUIProcessor.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormAdaptiveConfigUIProcessor.java index e573339875..1fc76077c1 100644 --- a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormAdaptiveConfigUIProcessor.java +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormAdaptiveConfigUIProcessor.java @@ -1,20 +1,14 @@ package com.fr.design.fun.impl; -import com.fr.design.beans.BasicBeanPane; import com.fr.design.fun.FormAdaptiveConfigUIProcessor; -import com.fr.stable.fun.impl.AbstractProvider; import com.fr.stable.fun.mark.API; -import javax.swing.JComponent; -import java.awt.Dimension; -import java.awt.image.BufferedImage; - /** * Created by kerry on 2020-04-09 */ @API(level = FormAdaptiveConfigUIProcessor.CURRENT_LEVEL) -public abstract class AbstractFormAdaptiveConfigUIProcessor extends AbstractProvider implements FormAdaptiveConfigUIProcessor { +public abstract class AbstractFormAdaptiveConfigUIProcessor implements FormAdaptiveConfigUIProcessor { @Override public int currentAPILevel() { @@ -26,13 +20,4 @@ public abstract class AbstractFormAdaptiveConfigUIProcessor extends AbstractProv return DEFAULT_LAYER_INDEX; } - @Override - public BasicBeanPane getConfigPane() { - return null; - } - - @Override - public BufferedImage paintFormElementCaseImage(Dimension size, JComponent elementCasePane) { - return null; - } } diff --git a/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java index bbf5106c35..c24125059c 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java @@ -1,11 +1,9 @@ package com.fr.design.report.fit.menupane; -import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.JTemplateAction; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.UIDialog; -import com.fr.design.fun.FormAdaptiveConfigUIProcessor; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.design.menu.MenuKeySet; @@ -44,10 +42,6 @@ public class ReportFitAttrAction extends JTemplateAction { @Override public String getMenuName() { - FormAdaptiveConfigUIProcessor configPane = ExtraDesignClassManager.getInstance().getSingle(FormAdaptiveConfigUIProcessor.MARK_STRING); - if (configPane != null) { - return configPane.getConfigPane().getTitle(); - } return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Elementcase"); } @@ -91,13 +85,7 @@ public class ReportFitAttrAction extends JTemplateAction { final TemplateFitAttrPane attrPane = new TemplateFitAttrPane(); showReportFitDialog(fitAttr, jwb, wbTpl, attrPane); } else { - BasicBeanPane attrPane = null; - FormAdaptiveConfigUIProcessor configPane = ExtraDesignClassManager.getInstance().getSingle(FormAdaptiveConfigUIProcessor.MARK_STRING); - if (configPane != null) { - attrPane = configPane.getConfigPane(); - }else{ - attrPane = new ReportFitAttrPane(); - } + final ReportFitAttrPane attrPane = new ReportFitAttrPane(); showReportFitDialog(fitAttr, jwb, wbTpl, attrPane); } } 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 e95a7962c2..5502274bcd 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 @@ -31,6 +31,7 @@ import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.properties.FormWidgetAuthorityEditPane; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; +import com.fr.design.fun.FormAdaptiveConfigUIProcessor; import com.fr.design.fun.PreviewProvider; import com.fr.design.fun.PropertyItemPaneProvider; import com.fr.design.gui.frpane.HyperlinkGroupPane; @@ -129,20 +130,20 @@ public class JForm extends JTemplate implements BaseJForm implements BaseJForm providers = classManager.getArray(PropertyItemPaneProvider.XML_TAG); for (PropertyItemPaneProvider provider : providers) { addPane(provider); } } - + private void addPane(PropertyItemPaneProvider provider) { - + PaneHolder holder = provider.getPaneHolder(FormDesigner.class); if (holder != null) { JPanel panel = holder.getInstance(formDesign); EastRegionContainerPane.getInstance().replaceKeyPane(provider.key(), panel); } } - + @Override public void refreshEastPropertiesPane() { // 暂时用不到,遇到的时候再加刷新右侧tab面板的代码 @@ -561,12 +562,21 @@ public class JForm extends JTemplate implements BaseJForm implements BaseJForm