Browse Source

Merge pull request #1584 in DESIGN/design from ~KERRY/design_10.0:release/10.0 to release/10.0

* commit '434692b6801f997b5867ea5a9341c82bb95565c5':
  代码调整
  代码修改
  代码修改
  代码提交
  KERNEL-3501 决策报表自适应后端重构,整理代码,提供单元格单位修改的接口
feature/big-screen
kerry 5 years ago
parent
commit
7265d0ecb0
  1. 3
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  2. 36
      designer-base/src/main/java/com/fr/design/fun/FormAdaptiveConfigUIProcessor.java
  3. 39
      designer-base/src/main/java/com/fr/design/fun/ReportLengthUNITProvider.java
  4. 23
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormAdaptiveConfigUIProcessor.java
  5. 42
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractReportLengthUNITProvider.java
  6. 52
      designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java
  7. 32
      designer-base/src/main/java/com/fr/design/unit/impl/CMReportLengthUNIT.java
  8. 31
      designer-base/src/main/java/com/fr/design/unit/impl/INCHReportLengthUNIT.java
  9. 31
      designer-base/src/main/java/com/fr/design/unit/impl/MMReportLengthUNIT.java
  10. 31
      designer-base/src/main/java/com/fr/design/unit/impl/PTReportLengthUNIT.java
  11. 14
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  12. 5
      designer-form/src/main/java/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java
  13. 38
      designer-realize/src/main/java/com/fr/design/actions/columnrow/ColumnRowSizingAction.java
  14. 53
      designer-realize/src/main/java/com/fr/design/condition/WHPane.java
  15. 7
      designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java
  16. 26
      designer-realize/src/main/java/com/fr/grid/AbstractGridHeaderMouseHandler.java

3
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.VcsConfigManager;
import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.design.mainframe.vcs.common.VcsHelper;
import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.unit.UnitConvertUtil;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.widget.FRWidgetFactory; import com.fr.design.widget.FRWidgetFactory;
import com.fr.general.ComparatorUtils; 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 = 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.setPreferredSize(new Dimension(80, 20));
pageLengthComboBox.setMinimumSize(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.setPreferredSize(new Dimension(80, 20));
reportLengthComboBox.setMinimumSize(new Dimension(80, 20)); reportLengthComboBox.setMinimumSize(new Dimension(80, 20));
UILabel pagelengthLabel = new UILabel(i18nText("Fine-Design_Basic_Page_Setup_Scale_Units") + ":"); UILabel pagelengthLabel = new UILabel(i18nText("Fine-Design_Basic_Page_Setup_Scale_Units") + ":");

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

@ -0,0 +1,36 @@
package com.fr.design.fun;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.ShortCut;
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 = "FormAdaptiveConfigUIProcessor";
int CURRENT_LEVEL = 1;
/**
* 获取表单自适应配置菜单
* @return 表单自适应配置菜单
*/
ShortCut getConfigShortCut(JTemplate jTemplate);
/**
* 绘制自适应下报表块在表单界面中显示图片
* @param size 绘制尺寸
* @param elementCasePane 报表块内容对象
* @return 自适应下报表块在表单界面中显示的图片
*/
BufferedImage paintFormElementCaseImage(Dimension size, JComponent elementCasePane);
}

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

23
designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormAdaptiveConfigUIProcessor.java

@ -0,0 +1,23 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.FormAdaptiveConfigUIProcessor;
import com.fr.stable.fun.mark.API;
/**
* Created by kerry on 2020-04-09
*/
@API(level = FormAdaptiveConfigUIProcessor.CURRENT_LEVEL)
public abstract class AbstractFormAdaptiveConfigUIProcessor implements FormAdaptiveConfigUIProcessor {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public int layerIndex() {
return DEFAULT_LAYER_INDEX;
}
}

42
designer-base/src/main/java/com/fr/design/fun/impl/AbstractReportLengthUNITProvider.java

@ -0,0 +1,42 @@
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 UNIT.ZERO;
}
}

52
designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java

@ -0,0 +1,52 @@
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;
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<ReportLengthUNITProvider> lengthUNITList = new ArrayList<ReportLengthUNITProvider>();
static {
lengthUNITList.add(new MMReportLengthUNIT());
lengthUNITList.add(new CMReportLengthUNIT());
lengthUNITList.add(new INCHReportLengthUNIT());
lengthUNITList.add(new PTReportLengthUNIT());
Set<ReportLengthUNITProvider> providers = ExtraDesignClassManager.getInstance().getArray(ReportLengthUNITProvider.MARK_STRING);
for (ReportLengthUNITProvider provider : providers) {
lengthUNITList.add(provider);
}
}
private UnitConvertUtil() {
}
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;
}
}

32
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.fun.impl.AbstractReportLengthUNITProvider;
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 AbstractReportLengthUNITProvider {
@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);
}
}

31
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.fun.impl.AbstractReportLengthUNITProvider;
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 AbstractReportLengthUNITProvider {
@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);
}
}

31
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.fun.impl.AbstractReportLengthUNITProvider;
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 AbstractReportLengthUNITProvider {
@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);
}
}

31
designer-base/src/main/java/com/fr/design/unit/impl/PTReportLengthUNIT.java

@ -0,0 +1,31 @@
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;
/**
* Created by kerry on 2020-04-09
*/
public class PTReportLengthUNIT extends AbstractReportLengthUNITProvider {
@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);
}
}

14
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.designer.properties.FormWidgetAuthorityEditPane;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import com.fr.design.fun.FormAdaptiveConfigUIProcessor;
import com.fr.design.fun.PreviewProvider; import com.fr.design.fun.PreviewProvider;
import com.fr.design.fun.PropertyItemPaneProvider; import com.fr.design.fun.PropertyItemPaneProvider;
import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.gui.frpane.HyperlinkGroupPane;
@ -561,12 +562,21 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
@Override @Override
public ShortCut[] shortcut4TemplateMenu() { public ShortCut[] shortcut4TemplateMenu() {
if (this.index == FORM_TAB) { if (this.index == FORM_TAB) {
return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new FormMobileAttrAction(this), new ReportFitAttrAction(this)}, new ShortCut[0]); return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new FormMobileAttrAction(this), getReportFitAttrAction()}, new ShortCut[0]);
} else { } else {
return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new FormMobileAttrAction(this), new ReportFitAttrAction(this)}, this.elementCaseDesign.shortcut4TemplateMenu()); return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new FormMobileAttrAction(this), getReportFitAttrAction()}, this.elementCaseDesign.shortcut4TemplateMenu());
} }
} }
private ShortCut getReportFitAttrAction() {
FormAdaptiveConfigUIProcessor adaptiveConfigUI = ExtraDesignClassManager.getInstance().getSingle(FormAdaptiveConfigUIProcessor.MARK_STRING);
if (adaptiveConfigUI != null) {
return adaptiveConfigUI.getConfigShortCut(this);
}
return new ReportFitAttrAction(this);
}
/** /**
* 权限细粒度模板菜单 * 权限细粒度模板菜单
* 表单中去掉此菜单项 * 表单中去掉此菜单项

5
designer-form/src/main/java/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java

@ -127,6 +127,11 @@ public class FormWidgetDefinePaneFactoryBase {
} }
public static void registerDefinePane(Class<? extends Widget> widget, Appearance appearance) {
defineMap.put(widget, appearance);
}
public static RN createWidgetDefinePane(XCreator creator, FormDesigner designer, Widget widget, Operator operator) { public static RN createWidgetDefinePane(XCreator creator, FormDesigner designer, Widget widget, Operator operator) {
if (isExtraXWidget(widget)) { if (isExtraXWidget(widget)) {
WidgetDefinePane widgetDefinePane = new WidgetDefinePane(creator, designer); WidgetDefinePane widgetDefinePane = new WidgetDefinePane(creator, designer);

38
designer-realize/src/main/java/com/fr/design/actions/columnrow/ColumnRowSizingAction.java

@ -4,20 +4,18 @@
package com.fr.design.actions.columnrow; package com.fr.design.actions.columnrow;
import com.fr.design.DesignerEnvManager; 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;
import com.fr.design.gui.frpane.UnitInputPane.ValueNotChangeException; import com.fr.design.gui.frpane.UnitInputPane.ValueNotChangeException;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.fun.ReportLengthUNITProvider;
import com.fr.design.unit.UnitConvertUtil;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.report.elementcase.ElementCase; import com.fr.report.elementcase.ElementCase;
import com.fr.stable.ArrayUtils; 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; import com.fr.stable.unit.UNIT;
/** /**
@ -52,16 +50,8 @@ public abstract class ColumnRowSizingAction extends AbstractColumnRowIndexAction
try { try {
float newHeight = (float) uPane.update(); float newHeight = (float) uPane.update();
int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit(); int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit();
UNIT len; ReportLengthUNITProvider lengthUNIT = UnitConvertUtil.parseLengthUNIT(unitType);
if (unitType == Constants.UNIT_CM) { UNIT len = lengthUNIT.float2UNIT(newHeight);
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);
}
updateAction(report, len, finalCS); updateAction(report, len, finalCS);
} catch (ValueNotChangeException e) { } catch (ValueNotChangeException e) {
// nothing // nothing
@ -75,21 +65,9 @@ public abstract class ColumnRowSizingAction extends AbstractColumnRowIndexAction
protected void populateNumberDialog(final UnitInputPane uPane, UNIT unit) { protected void populateNumberDialog(final UnitInputPane uPane, UNIT unit) {
int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit(); int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit();
float va; ReportLengthUNITProvider lengthUNIT = UnitConvertUtil.parseLengthUNIT(unitType);
if (unitType == Constants.UNIT_CM) { float va = lengthUNIT.unit2Value4Scale(unit);
va = unit.toCMValue4Scale2(); uPane.setUnitText(lengthUNIT.unitText());
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"));
}
uPane.populate(va); uPane.populate(va);
} }

53
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.DesignerEnvManager;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UIBasicSpinner; import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.fun.ReportLengthUNITProvider;
import com.fr.design.unit.UnitConvertUtil;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.report.cell.cellattr.highlight.HighlightAction; import com.fr.report.cell.cellattr.highlight.HighlightAction;
import com.fr.stable.Constants; import com.fr.stable.unit.UNIT;
import com.fr.stable.unit.*;
import javax.swing.*; import javax.swing.JSpinner;
import java.awt.event.FocusAdapter; import javax.swing.SpinnerNumberModel;
import java.awt.event.FocusEvent;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.ParseException;
/** /**
* @author richie * @author richie
@ -45,23 +44,12 @@ public abstract class WHPane extends ConditionAttrSingleConditionPane<HighlightA
return nameForPopupMenuItem(); return nameForPopupMenuItem();
} }
public void populate(HighlightAction ha, JSpinner sp) { public void populate(HighlightAction ha, JSpinner sp) {
int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit(); int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit();
UNIT width = getUnit(ha); UNIT width = getUnit(ha);
double va; ReportLengthUNITProvider lengthUNIT = UnitConvertUtil.parseLengthUNIT(unitType);
if (unitType == Constants.UNIT_CM) { double va = lengthUNIT.unit2Value4Scale(width);
va = width.toCMValue4Scale2(); unitLabel.setText(lengthUNIT.unitText());
unitLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_CM"));
} else if (unitType == Constants.UNIT_INCH) {
va = width.toINCHValue4Scale3();
unitLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_INCH"));
} else if (unitType == Constants.UNIT_PT) {
va = width.toPTValue4Scale2();
unitLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_PT_Duplicate"));
} else {
va = width.toMMValue4Scale2();
unitLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_MM"));
}
// 只保留两位 // 只保留两位
Float d = new Float(new BigDecimal(va + "").setScale(2, BigDecimal.ROUND_DOWN).floatValue()); Float d = new Float(new BigDecimal(va + "").setScale(2, BigDecimal.ROUND_DOWN).floatValue());
sp.setValue(d); sp.setValue(d);
@ -71,15 +59,8 @@ public abstract class WHPane extends ConditionAttrSingleConditionPane<HighlightA
protected String getUnitString() { protected String getUnitString() {
int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit(); int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit();
if (unitType == Constants.UNIT_CM) { ReportLengthUNITProvider lengthUNIT = UnitConvertUtil.parseLengthUNIT(unitType);
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_CM"); return lengthUNIT.unitText();
} else if (unitType == Constants.UNIT_INCH) {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_INCH");
} else if (unitType == Constants.UNIT_PT) {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_PT_Duplicate");
} else {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_MM");
}
} }
public HighlightAction update(UIBasicSpinner sp) { public HighlightAction update(UIBasicSpinner sp) {
@ -87,16 +68,8 @@ public abstract class WHPane extends ConditionAttrSingleConditionPane<HighlightA
// 只保留两位 // 只保留两位
newWidth = new Float(new BigDecimal(newWidth + "").setScale(2, BigDecimal.ROUND_DOWN).floatValue()); newWidth = new Float(new BigDecimal(newWidth + "").setScale(2, BigDecimal.ROUND_DOWN).floatValue());
int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit(); int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit();
UNIT width; ReportLengthUNITProvider lengthUNIT = UnitConvertUtil.parseLengthUNIT(unitType);
if (unitType == Constants.UNIT_CM) { UNIT width = lengthUNIT.float2UNIT(newWidth);
width = new CM(newWidth);
} else if (unitType == Constants.UNIT_INCH) {
width = new INCH(newWidth);
} else if (unitType == Constants.UNIT_PT) {
width = new PT(newWidth);
} else {
width = new MM(newWidth);
}
return returnAction(width); return returnAction(width);
} }

7
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.base.vcs.DesignerMode;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.AllowAuthorityEditAction; import com.fr.design.actions.AllowAuthorityEditAction;
import com.fr.design.actions.ExitAuthorityEditAction; import com.fr.design.actions.ExitAuthorityEditAction;
import com.fr.design.base.mode.DesignModeContext; 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.ShortCut;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.design.present.ConditionAttributesGroupPane; import com.fr.design.present.ConditionAttributesGroupPane;
import com.fr.design.fun.FormAdaptiveConfigUIProcessor;
import com.fr.design.selection.SelectableElement; import com.fr.design.selection.SelectableElement;
import com.fr.design.selection.Selectedable; import com.fr.design.selection.Selectedable;
import com.fr.design.selection.SelectionListener; import com.fr.design.selection.SelectionListener;
@ -78,6 +80,7 @@ public class FormElementCaseDesigner
} }
@Override @Override
public void setTarget(T t) { public void setTarget(T t) {
super.setTarget(t); super.setTarget(t);
@ -123,6 +126,10 @@ public class FormElementCaseDesigner
*/ */
@Override @Override
public BufferedImage getElementCaseImage(Dimension size) { 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; BufferedImage image = null;
try { try {
image = new java.awt.image.BufferedImage(size.width, size.height, image = new java.awt.image.BufferedImage(size.width, size.height,

26
designer-realize/src/main/java/com/fr/grid/AbstractGridHeaderMouseHandler.java

@ -5,8 +5,10 @@ import com.fr.base.DynamicUnitList;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.fun.ReportLengthUNITProvider;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.unit.UnitConvertUtil;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.FloatSelection;
@ -14,7 +16,6 @@ import com.fr.grid.selection.Selection;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.report.elementcase.ElementCase; import com.fr.report.elementcase.ElementCase;
import com.fr.stable.ColumnRow; import com.fr.stable.ColumnRow;
import com.fr.stable.Constants;
import com.fr.stable.unit.FU; import com.fr.stable.unit.FU;
import com.fr.stable.unit.UNIT; import com.fr.stable.unit.UNIT;
@ -306,25 +307,10 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
// int resolution = ScreenResolution.getScreenResolution(); // int resolution = ScreenResolution.getScreenResolution();
FU ulen = FU.valueOfPix((int) doubleValue, resolution); FU ulen = FU.valueOfPix((int) doubleValue, resolution);
FU tulen = FU.valueOfPix((int) totalDoubleValue, resolution); FU tulen = FU.valueOfPix((int) totalDoubleValue, resolution);
String unit; ReportLengthUNITProvider lengthUNIT = UnitConvertUtil.parseLengthUNIT(unitType);
double len, tlen; String unit = lengthUNIT.unitText();
if (unitType == Constants.UNIT_PT) { double len = lengthUNIT.unit2Value4Scale(ulen);
len = ulen.toPTValue4Scale2(); double tlen = lengthUNIT.unit2Value4Scale(tulen);
tlen = tulen.toPTValue4Scale2();
unit = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_PT");
} else if (unitType == Constants.UNIT_CM) {
len = ulen.toCMValue4Scale2();
tlen = tulen.toCMValue4Scale2();
unit = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_CM");
} else if (unitType == Constants.UNIT_INCH) {
len = ulen.toINCHValue4Scale3();
tlen = tulen.toINCHValue4Scale3();
unit = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_INCH");
} else {
len = ulen.toMMValue4Scale2();
tlen = tulen.toMMValue4Scale2();
unit = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_MM");
}
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(String.format("%.2f", new Double(len))) sb.append(String.format("%.2f", new Double(len)))
.append('/').append(String.format("%.2f", new Double(tlen))) .append('/').append(String.format("%.2f", new Double(tlen)))

Loading…
Cancel
Save