mirror of https://github.com/apache/poi.git
[bug-64691] rename field
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1881237 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
17e3eaadae
commit
f89528addc
|
@ -38,7 +38,7 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.STDataValidationOpera
|
||||||
public class XSSFDataValidation implements DataValidation {
|
public class XSSFDataValidation implements DataValidation {
|
||||||
private static final int MAX_TEXT_LENGTH = 255;
|
private static final int MAX_TEXT_LENGTH = 255;
|
||||||
|
|
||||||
private CTDataValidation ctDdataValidation;
|
private CTDataValidation ctDataValidation;
|
||||||
private XSSFDataValidationConstraint validationConstraint;
|
private XSSFDataValidationConstraint validationConstraint;
|
||||||
private CellRangeAddressList regions;
|
private CellRangeAddressList regions;
|
||||||
|
|
||||||
|
@ -90,12 +90,12 @@ public class XSSFDataValidation implements DataValidation {
|
||||||
public XSSFDataValidation(XSSFDataValidationConstraint constraint,CellRangeAddressList regions,CTDataValidation ctDataValidation) {
|
public XSSFDataValidation(XSSFDataValidationConstraint constraint,CellRangeAddressList regions,CTDataValidation ctDataValidation) {
|
||||||
super();
|
super();
|
||||||
this.validationConstraint = constraint;
|
this.validationConstraint = constraint;
|
||||||
this.ctDdataValidation = ctDataValidation;
|
this.ctDataValidation = ctDataValidation;
|
||||||
this.regions = regions;
|
this.regions = regions;
|
||||||
}
|
}
|
||||||
|
|
||||||
CTDataValidation getCtDdataValidation() {
|
CTDataValidation getCtDataValidation() {
|
||||||
return ctDdataValidation;
|
return ctDataValidation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -111,8 +111,8 @@ public class XSSFDataValidation implements DataValidation {
|
||||||
if(text != null && text.length() > MAX_TEXT_LENGTH) {
|
if(text != null && text.length() > MAX_TEXT_LENGTH) {
|
||||||
throw new IllegalStateException("Error-text cannot be longer than 255 characters, but had: " + text);
|
throw new IllegalStateException("Error-text cannot be longer than 255 characters, but had: " + text);
|
||||||
}
|
}
|
||||||
ctDdataValidation.setErrorTitle(encodeUtf(title));
|
ctDataValidation.setErrorTitle(encodeUtf(title));
|
||||||
ctDdataValidation.setError(encodeUtf(text));
|
ctDataValidation.setError(encodeUtf(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -126,8 +126,8 @@ public class XSSFDataValidation implements DataValidation {
|
||||||
if(text != null && text.length() > MAX_TEXT_LENGTH) {
|
if(text != null && text.length() > MAX_TEXT_LENGTH) {
|
||||||
throw new IllegalStateException("Error-text cannot be longer than 255 characters, but had: " + text);
|
throw new IllegalStateException("Error-text cannot be longer than 255 characters, but had: " + text);
|
||||||
}
|
}
|
||||||
ctDdataValidation.setPromptTitle(encodeUtf(title));
|
ctDataValidation.setPromptTitle(encodeUtf(title));
|
||||||
ctDdataValidation.setPrompt(encodeUtf(text));
|
ctDataValidation.setPrompt(encodeUtf(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -165,63 +165,63 @@ public class XSSFDataValidation implements DataValidation {
|
||||||
* @see org.apache.poi.ss.usermodel.DataValidation#getEmptyCellAllowed()
|
* @see org.apache.poi.ss.usermodel.DataValidation#getEmptyCellAllowed()
|
||||||
*/
|
*/
|
||||||
public boolean getEmptyCellAllowed() {
|
public boolean getEmptyCellAllowed() {
|
||||||
return ctDdataValidation.getAllowBlank();
|
return ctDataValidation.getAllowBlank();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.apache.poi.ss.usermodel.DataValidation#getErrorBoxText()
|
* @see org.apache.poi.ss.usermodel.DataValidation#getErrorBoxText()
|
||||||
*/
|
*/
|
||||||
public String getErrorBoxText() {
|
public String getErrorBoxText() {
|
||||||
return ctDdataValidation.getError();
|
return ctDataValidation.getError();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.apache.poi.ss.usermodel.DataValidation#getErrorBoxTitle()
|
* @see org.apache.poi.ss.usermodel.DataValidation#getErrorBoxTitle()
|
||||||
*/
|
*/
|
||||||
public String getErrorBoxTitle() {
|
public String getErrorBoxTitle() {
|
||||||
return ctDdataValidation.getErrorTitle();
|
return ctDataValidation.getErrorTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.apache.poi.ss.usermodel.DataValidation#getErrorStyle()
|
* @see org.apache.poi.ss.usermodel.DataValidation#getErrorStyle()
|
||||||
*/
|
*/
|
||||||
public int getErrorStyle() {
|
public int getErrorStyle() {
|
||||||
return reverseErrorStyleMappings.get(ctDdataValidation.getErrorStyle());
|
return reverseErrorStyleMappings.get(ctDataValidation.getErrorStyle());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.apache.poi.ss.usermodel.DataValidation#getPromptBoxText()
|
* @see org.apache.poi.ss.usermodel.DataValidation#getPromptBoxText()
|
||||||
*/
|
*/
|
||||||
public String getPromptBoxText() {
|
public String getPromptBoxText() {
|
||||||
return ctDdataValidation.getPrompt();
|
return ctDataValidation.getPrompt();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.apache.poi.ss.usermodel.DataValidation#getPromptBoxTitle()
|
* @see org.apache.poi.ss.usermodel.DataValidation#getPromptBoxTitle()
|
||||||
*/
|
*/
|
||||||
public String getPromptBoxTitle() {
|
public String getPromptBoxTitle() {
|
||||||
return ctDdataValidation.getPromptTitle();
|
return ctDataValidation.getPromptTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.apache.poi.ss.usermodel.DataValidation#getShowErrorBox()
|
* @see org.apache.poi.ss.usermodel.DataValidation#getShowErrorBox()
|
||||||
*/
|
*/
|
||||||
public boolean getShowErrorBox() {
|
public boolean getShowErrorBox() {
|
||||||
return ctDdataValidation.getShowErrorMessage();
|
return ctDataValidation.getShowErrorMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.apache.poi.ss.usermodel.DataValidation#getShowPromptBox()
|
* @see org.apache.poi.ss.usermodel.DataValidation#getShowPromptBox()
|
||||||
*/
|
*/
|
||||||
public boolean getShowPromptBox() {
|
public boolean getShowPromptBox() {
|
||||||
return ctDdataValidation.getShowInputMessage();
|
return ctDataValidation.getShowInputMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.apache.poi.ss.usermodel.DataValidation#getSuppressDropDownArrow()
|
* @see org.apache.poi.ss.usermodel.DataValidation#getSuppressDropDownArrow()
|
||||||
*/
|
*/
|
||||||
public boolean getSuppressDropDownArrow() {
|
public boolean getSuppressDropDownArrow() {
|
||||||
return !ctDdataValidation.getShowDropDown();
|
return !ctDataValidation.getShowDropDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -235,28 +235,28 @@ public class XSSFDataValidation implements DataValidation {
|
||||||
* @see org.apache.poi.ss.usermodel.DataValidation#setEmptyCellAllowed(boolean)
|
* @see org.apache.poi.ss.usermodel.DataValidation#setEmptyCellAllowed(boolean)
|
||||||
*/
|
*/
|
||||||
public void setEmptyCellAllowed(boolean allowed) {
|
public void setEmptyCellAllowed(boolean allowed) {
|
||||||
ctDdataValidation.setAllowBlank(allowed);
|
ctDataValidation.setAllowBlank(allowed);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.apache.poi.ss.usermodel.DataValidation#setErrorStyle(int)
|
* @see org.apache.poi.ss.usermodel.DataValidation#setErrorStyle(int)
|
||||||
*/
|
*/
|
||||||
public void setErrorStyle(int errorStyle) {
|
public void setErrorStyle(int errorStyle) {
|
||||||
ctDdataValidation.setErrorStyle(errorStyleMappings.get(errorStyle));
|
ctDataValidation.setErrorStyle(errorStyleMappings.get(errorStyle));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.apache.poi.ss.usermodel.DataValidation#setShowErrorBox(boolean)
|
* @see org.apache.poi.ss.usermodel.DataValidation#setShowErrorBox(boolean)
|
||||||
*/
|
*/
|
||||||
public void setShowErrorBox(boolean show) {
|
public void setShowErrorBox(boolean show) {
|
||||||
ctDdataValidation.setShowErrorMessage(show);
|
ctDataValidation.setShowErrorMessage(show);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.apache.poi.ss.usermodel.DataValidation#setShowPromptBox(boolean)
|
* @see org.apache.poi.ss.usermodel.DataValidation#setShowPromptBox(boolean)
|
||||||
*/
|
*/
|
||||||
public void setShowPromptBox(boolean show) {
|
public void setShowPromptBox(boolean show) {
|
||||||
ctDdataValidation.setShowInputMessage(show);
|
ctDataValidation.setShowInputMessage(show);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -264,7 +264,7 @@ public class XSSFDataValidation implements DataValidation {
|
||||||
*/
|
*/
|
||||||
public void setSuppressDropDownArrow(boolean suppress) {
|
public void setSuppressDropDownArrow(boolean suppress) {
|
||||||
if (validationConstraint.getValidationType()==ValidationType.LIST) {
|
if (validationConstraint.getValidationType()==ValidationType.LIST) {
|
||||||
ctDdataValidation.setShowDropDown(!suppress);
|
ctDataValidation.setShowDropDown(!suppress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4037,7 +4037,7 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
|
||||||
}
|
}
|
||||||
int currentCount = dataValidations.sizeOfDataValidationArray();
|
int currentCount = dataValidations.sizeOfDataValidationArray();
|
||||||
CTDataValidation newval = dataValidations.addNewDataValidation();
|
CTDataValidation newval = dataValidations.addNewDataValidation();
|
||||||
newval.set(xssfDataValidation.getCtDdataValidation());
|
newval.set(xssfDataValidation.getCtDataValidation());
|
||||||
dataValidations.setCount(currentCount + 1L);
|
dataValidations.setCount(currentCount + 1L);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -325,7 +325,7 @@ public class TestXSSFDataValidation extends BaseTestDataValidation {
|
||||||
sheet.addValidationData(validation);
|
sheet.addValidationData(validation);
|
||||||
|
|
||||||
final List<XSSFDataValidation> dataValidations = sheet.getDataValidations();
|
final List<XSSFDataValidation> dataValidations = sheet.getDataValidations();
|
||||||
assertTrue(dataValidations.get(0).getCtDdataValidation().getAllowBlank());
|
assertTrue(dataValidations.get(0).getCtDataValidation().getAllowBlank());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,12 +335,12 @@ public class TestXSSFDataValidation extends BaseTestDataValidation {
|
||||||
XSSFSheet sheet = wb.createSheet();
|
XSSFSheet sheet = wb.createSheet();
|
||||||
|
|
||||||
final XSSFDataValidation validation = createValidation(sheet);
|
final XSSFDataValidation validation = createValidation(sheet);
|
||||||
validation.getCtDdataValidation().setAllowBlank(false);
|
validation.getCtDataValidation().setAllowBlank(false);
|
||||||
|
|
||||||
sheet.addValidationData(validation);
|
sheet.addValidationData(validation);
|
||||||
|
|
||||||
final List<XSSFDataValidation> dataValidations = sheet.getDataValidations();
|
final List<XSSFDataValidation> dataValidations = sheet.getDataValidations();
|
||||||
assertFalse(dataValidations.get(0).getCtDdataValidation().getAllowBlank());
|
assertFalse(dataValidations.get(0).getCtDataValidation().getAllowBlank());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,12 +350,12 @@ public class TestXSSFDataValidation extends BaseTestDataValidation {
|
||||||
XSSFSheet sheet = wb.createSheet();
|
XSSFSheet sheet = wb.createSheet();
|
||||||
|
|
||||||
final XSSFDataValidation validation = createValidation(sheet);
|
final XSSFDataValidation validation = createValidation(sheet);
|
||||||
validation.getCtDdataValidation().setAllowBlank(true);
|
validation.getCtDataValidation().setAllowBlank(true);
|
||||||
|
|
||||||
sheet.addValidationData(validation);
|
sheet.addValidationData(validation);
|
||||||
|
|
||||||
final List<XSSFDataValidation> dataValidations = sheet.getDataValidations();
|
final List<XSSFDataValidation> dataValidations = sheet.getDataValidations();
|
||||||
assertTrue(dataValidations.get(0).getCtDdataValidation().getAllowBlank());
|
assertTrue(dataValidations.get(0).getCtDataValidation().getAllowBlank());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue