Browse Source
* commit '434692b6801f997b5867ea5a9341c82bb95565c5': 代码调整 代码修改 代码修改 代码提交 KERNEL-3501 决策报表自适应后端重构,整理代码,提供单元格单位修改的接口feature/big-screen
kerry
5 years ago
17 changed files with 389 additions and 112 deletions
@ -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); |
||||
|
||||
} |
||||
|
@ -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); |
||||
} |
@ -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; |
||||
} |
||||
|
||||
} |
@ -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; |
||||
} |
||||
} |
||||
|
@ -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; |
||||
} |
||||
} |
@ -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); |
||||
} |
||||
|
||||
} |
@ -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); |
||||
} |
||||
} |
@ -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); |
||||
} |
||||
} |
@ -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); |
||||
} |
||||
} |
Loading…
Reference in new issue