|
|
|
@ -35,7 +35,7 @@ public enum CellFormatType {
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<String> getItems() { |
|
|
|
|
return Arrays.asList(FormatField.getInstance().getFormatArray(FormatField.getInstance().getContents(SettingContent.FORMAT_NUMBER))); |
|
|
|
|
return Arrays.asList(FormatField.getInstance().getFormatArray(FormatField.getInstance().getContents(SettingContent.FORMAT_NUMBER), false)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -57,6 +57,12 @@ public enum CellFormatType {
|
|
|
|
|
public boolean isNeed(CellElement cellElement, String firstStr, String secondStr) { |
|
|
|
|
return cellElement.getStyle().getFormat() == null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean isEverChanged(Info info, String inputStr, String extraStr) { |
|
|
|
|
CellElement cellElement = (CellElement) info.getContent().getReplaceObject(); |
|
|
|
|
return (cellElement.getStyle() != null && cellElement.getStyle().getFormat() == null); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
/** |
|
|
|
|
* 单元格-格式-货币 |
|
|
|
@ -69,7 +75,7 @@ public enum CellFormatType {
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<String> getItems() { |
|
|
|
|
return Arrays.asList(FormatField.getInstance().getFormatArray(FormatField.getInstance().getContents(SettingContent.FORMAT_MONEY))); |
|
|
|
|
return Arrays.asList(FormatField.getInstance().getFormatArray(FormatField.getInstance().getContents(SettingContent.FORMAT_MONEY), false)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -89,7 +95,7 @@ public enum CellFormatType {
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<String> getItems() { |
|
|
|
|
return Arrays.asList(FormatField.getInstance().getFormatArray(FormatField.getInstance().getContents(SettingContent.FORMAT_DATE))); |
|
|
|
|
return Arrays.asList(FormatField.getInstance().getFormatArray(FormatField.getInstance().getContents(SettingContent.FORMAT_DATE), false)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -97,6 +103,11 @@ public enum CellFormatType {
|
|
|
|
|
Format format = cellElement.getStyle().getFormat(); |
|
|
|
|
return format instanceof FineDateFormat && StringUtils.equals(((FineDateFormat) format).toPattern(), secondStr); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean isEverChanged(Info info, String inputStr, String extraStr) { |
|
|
|
|
return isEverChanged4FineDataFormat(info, extraStr); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
/** |
|
|
|
|
* 单元格-格式-时间 |
|
|
|
@ -109,7 +120,7 @@ public enum CellFormatType {
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<String> getItems() { |
|
|
|
|
return Arrays.asList(FormatField.getInstance().getFormatArray(FormatField.getInstance().getContents(SettingContent.FORMAT_TIME))); |
|
|
|
|
return Arrays.asList(FormatField.getInstance().getFormatArray(FormatField.getInstance().getContents(SettingContent.FORMAT_TIME), false)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -117,6 +128,11 @@ public enum CellFormatType {
|
|
|
|
|
Format format = cellElement.getStyle().getFormat(); |
|
|
|
|
return format instanceof FineDateFormat && StringUtils.equals(((FineDateFormat) format).toPattern(), secondStr); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean isEverChanged(Info info, String inputStr, String extraStr) { |
|
|
|
|
return isEverChanged4FineDataFormat(info, extraStr); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
/** |
|
|
|
|
* 单元格-格式-科学计数 |
|
|
|
@ -129,7 +145,7 @@ public enum CellFormatType {
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<String> getItems() { |
|
|
|
|
return Arrays.asList(FormatField.getInstance().getFormatArray(FormatField.getInstance().getContents(SettingContent.FORMAT_SCIENCE))); |
|
|
|
|
return Arrays.asList(FormatField.getInstance().getFormatArray(FormatField.getInstance().getContents(SettingContent.FORMAT_SCIENCE), false)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -149,7 +165,7 @@ public enum CellFormatType {
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<String> getItems() { |
|
|
|
|
return Arrays.asList(FormatField.getInstance().getFormatArray(FormatField.getInstance().getContents(SettingContent.FORMAT_PERCENT))); |
|
|
|
|
return Arrays.asList(FormatField.getInstance().getFormatArray(FormatField.getInstance().getContents(SettingContent.FORMAT_PERCENT), false)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -169,7 +185,7 @@ public enum CellFormatType {
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<String> getItems() { |
|
|
|
|
return Arrays.asList(FormatField.getInstance().getFormatArray(FormatField.getInstance().getContents(SettingContent.FORMAT_PERMILLAGE))); |
|
|
|
|
return Arrays.asList(FormatField.getInstance().getFormatArray(FormatField.getInstance().getContents(SettingContent.FORMAT_PERMILLAGE), false)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -187,6 +203,14 @@ public enum CellFormatType {
|
|
|
|
|
Format format = cellElement.getStyle().getFormat(); |
|
|
|
|
return format instanceof TextFormat; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean isEverChanged(Info info, String inputStr, String extraStr) { |
|
|
|
|
CellElement cellElement = (CellElement) info.getContent().getReplaceObject(); |
|
|
|
|
return !(cellElement.getStyle() != null |
|
|
|
|
&& cellElement.getStyle().getFormat() != null |
|
|
|
|
&& cellElement.getStyle().getFormat() instanceof TextFormat); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -256,4 +280,35 @@ public enum CellFormatType {
|
|
|
|
|
((NameStyle) cellElement.getStyle()).refreshStyle(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 是否修改过 |
|
|
|
|
* |
|
|
|
|
* @param info 存储单元格信息的数据结构 |
|
|
|
|
* @param inputStr 用户输入的第一级下拉框内容 |
|
|
|
|
* @param extraStr 用户输入的第二级下拉框内容 |
|
|
|
|
* @return 修改过返回true |
|
|
|
|
*/ |
|
|
|
|
public boolean isEverChanged(Info info, String inputStr, String extraStr) { |
|
|
|
|
CellElement cellElement = (CellElement) info.getContent().getReplaceObject(); |
|
|
|
|
return !(cellElement.getStyle() != null |
|
|
|
|
&& cellElement.getStyle().getFormat() != null |
|
|
|
|
&& cellElement.getStyle().getFormat() instanceof CoreDecimalFormat |
|
|
|
|
&& StringUtils.equals(((CoreDecimalFormat) cellElement.getStyle().getFormat()).toPattern(), extraStr)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 针对日期和时间类型的修改判定 |
|
|
|
|
* |
|
|
|
|
* @param info 存储单元格信息的数据结构 |
|
|
|
|
* @param extraStr 用户输入的第二级下拉框内容 |
|
|
|
|
* @return 修改过返回true |
|
|
|
|
*/ |
|
|
|
|
public boolean isEverChanged4FineDataFormat(Info info, String extraStr) { |
|
|
|
|
CellElement cellElement = (CellElement) info.getContent().getReplaceObject(); |
|
|
|
|
return !(cellElement.getStyle() != null |
|
|
|
|
&& cellElement.getStyle().getFormat() != null |
|
|
|
|
&& cellElement.getStyle().getFormat() instanceof FineDateFormat |
|
|
|
|
&& StringUtils.equals(((FineDateFormat) cellElement.getStyle().getFormat()).toPattern(), extraStr)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|