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. 2
      designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java
  7. 52
      designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java
  8. 32
      designer-base/src/main/java/com/fr/design/unit/impl/CMReportLengthUNIT.java
  9. 31
      designer-base/src/main/java/com/fr/design/unit/impl/INCHReportLengthUNIT.java
  10. 31
      designer-base/src/main/java/com/fr/design/unit/impl/MMReportLengthUNIT.java
  11. 31
      designer-base/src/main/java/com/fr/design/unit/impl/PTReportLengthUNIT.java
  12. 34
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  13. 7
      designer-form/src/main/java/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java
  14. 50
      designer-realize/src/main/java/com/fr/design/actions/columnrow/ColumnRowSizingAction.java
  15. 53
      designer-realize/src/main/java/com/fr/design/condition/WHPane.java
  16. 9
      designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java
  17. 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.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") + ":");

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

2
designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java

@ -102,4 +102,4 @@ public class ReportFitAttrAction extends JTemplateAction {
dialog.setVisible(true);
}
}
}

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

34
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<Form, FormUndoState> implements BaseJForm<F
public JForm() {
super(new Form(new WBorderLayout("form")), "Form");
initPluginPane();
startListenPlugin();
}
public JForm(Form form, FILE file) {
super(form, file);
initPluginPane();
startListenPlugin();
}
private void startListenPlugin() {
PluginFilter filter = new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
@ -162,25 +163,25 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
}
}, filter);
}
private void initPluginPane() {
ExtraDesignClassManager classManager = PluginModule.getAgent(PluginModule.ExtraDesign);
Set<PropertyItemPaneProvider> providers = classManager.getArray(PropertyItemPaneProvider.XML_TAG);
for (PropertyItemPaneProvider provider : providers) {
addPane(provider);
}
}
private void addPane(PropertyItemPaneProvider provider) {
PaneHolder<FormDesigner> 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<Form, FormUndoState> implements BaseJForm<F
@Override
public ShortCut[] shortcut4TemplateMenu() {
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 {
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);
}
/**
* 权限细粒度模板菜单
* 表单中去掉此菜单项
@ -825,7 +835,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
refreshWidgetLibPane();
}
private void refreshWidgetLibPane() {
if (EastRegionContainerPane.getInstance().getWidgetLibPane() == null) {
new Thread() {

7
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) {
if (isExtraXWidget(widget)) {
WidgetDefinePane widgetDefinePane = new WidgetDefinePane(creator, designer);
@ -165,4 +170,4 @@ public class FormWidgetDefinePaneFactoryBase {
}
}
}
}

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

@ -4,20 +4,18 @@
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.fun.ReportLengthUNITProvider;
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 +26,7 @@ public abstract class ColumnRowSizingAction extends AbstractColumnRowIndexAction
protected ColumnRowSizingAction(ElementCasePane t, int indexOfColumnOrRow) {
super(t, indexOfColumnOrRow);
}
@Override
protected boolean executeActionReturnUndoRecordNeededWithCellSelection(
CellSelection cs) {
@ -43,7 +41,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 +50,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);
}
ReportLengthUNITProvider lengthUNIT = UnitConvertUtil.parseLengthUNIT(unitType);
UNIT len = lengthUNIT.float2UNIT(newHeight);
updateAction(report, len, finalCS);
} catch (ValueNotChangeException e) {
// nothing
}
ePane.fireTargetModified();
}
}).setVisible(true);
@ -75,28 +65,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"));
}
ReportLengthUNITProvider 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);

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.gui.ilable.UILabel;
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.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<HighlightA
return nameForPopupMenuItem();
}
public void populate(HighlightAction ha, JSpinner sp) {
public void populate(HighlightAction ha, JSpinner sp) {
int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit();
UNIT width = getUnit(ha);
double va;
if (unitType == Constants.UNIT_CM) {
va = width.toCMValue4Scale2();
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"));
}
ReportLengthUNITProvider lengthUNIT = UnitConvertUtil.parseLengthUNIT(unitType);
double va = lengthUNIT.unit2Value4Scale(width);
unitLabel.setText(lengthUNIT.unitText());
// 只保留两位
Float d = new Float(new BigDecimal(va + "").setScale(2, BigDecimal.ROUND_DOWN).floatValue());
sp.setValue(d);
@ -71,15 +59,8 @@ public abstract class WHPane extends ConditionAttrSingleConditionPane<HighlightA
protected String getUnitString() {
int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit();
if (unitType == Constants.UNIT_CM) {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_CM");
} 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");
}
ReportLengthUNITProvider lengthUNIT = UnitConvertUtil.parseLengthUNIT(unitType);
return lengthUNIT.unitText();
}
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());
int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit();
UNIT width;
if (unitType == Constants.UNIT_CM) {
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);
}
ReportLengthUNITProvider lengthUNIT = UnitConvertUtil.parseLengthUNIT(unitType);
UNIT width = lengthUNIT.float2UNIT(newWidth);
return returnAction(width);
}

9
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.fun.FormAdaptiveConfigUIProcessor;
import com.fr.design.selection.SelectableElement;
import com.fr.design.selection.Selectedable;
import com.fr.design.selection.SelectionListener;
@ -78,6 +80,7 @@ public class FormElementCaseDesigner
}
@Override
public void setTarget(T t) {
super.setTarget(t);
@ -123,6 +126,10 @@ 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,
@ -351,4 +358,4 @@ public class FormElementCaseDesigner
public FormElementCaseProvider getEditingElementCase() {
return this.getEditingElementCasePane().getTarget();
}
}
}

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.vcs.DesignerMode;
import com.fr.design.DesignerEnvManager;
import com.fr.design.fun.ReportLengthUNITProvider;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.unit.UnitConvertUtil;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection;
@ -14,7 +16,6 @@ import com.fr.grid.selection.Selection;
import com.fr.log.FineLoggerFactory;
import com.fr.report.elementcase.ElementCase;
import com.fr.stable.ColumnRow;
import com.fr.stable.Constants;
import com.fr.stable.unit.FU;
import com.fr.stable.unit.UNIT;
@ -306,25 +307,10 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
// int resolution = ScreenResolution.getScreenResolution();
FU ulen = FU.valueOfPix((int) doubleValue, resolution);
FU tulen = FU.valueOfPix((int) totalDoubleValue, resolution);
String unit;
double len, tlen;
if (unitType == Constants.UNIT_PT) {
len = ulen.toPTValue4Scale2();
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");
}
ReportLengthUNITProvider lengthUNIT = UnitConvertUtil.parseLengthUNIT(unitType);
String unit = lengthUNIT.unitText();
double len = lengthUNIT.unit2Value4Scale(ulen);
double tlen = lengthUNIT.unit2Value4Scale(tulen);
StringBuilder sb = new StringBuilder();
sb.append(String.format("%.2f", new Double(len)))
.append('/').append(String.format("%.2f", new Double(tlen)))

Loading…
Cancel
Save