Example usage for org.apache.poi.ss.usermodel DataValidation createPromptBox

List of usage examples for org.apache.poi.ss.usermodel DataValidation createPromptBox

Introduction

In this page you can find the example usage for org.apache.poi.ss.usermodel DataValidation createPromptBox.

Prototype

public abstract void createPromptBox(String title, String text);

Source Link

Document

Sets the title and text for the prompt box .

Usage

From source file:com.dituiba.excel.DefaultValidateAdapter.java

License:Apache License

/**
 * ??// w  w  w  .jav  a  2 s  .c om
 * @param validation
 * @param config
 */
protected void setValidationTip(DataValidation validation, Annotation config) {
    String tipLangName = AdapterUtil.getTipLangName(config);
    if (!ObjectHelper.isNullOrEmptyString(tipLangName)) {
        validation.createPromptBox(LanguageUtils.translate(Message.TIP), LanguageUtils.translate(tipLangName));
    }
}

From source file:de.jlo.talendcomp.excel.SpreadsheetOutput.java

License:Apache License

private void createNewAppendingDataValidationAsCopy(Sheet sheet, DataValidation originalDv, int lastRowIndex) {
    CellRangeAddressList originalAl = originalDv.getRegions();
    CellRangeAddressList appendingAddressList = createNewAppendingCellRangeAddressList(originalAl,
            lastRowIndex);//  w  w w  .j a  v  a  2s .  c o m
    DataValidationHelper dvHelper = sheet.getDataValidationHelper();
    DataValidation newValidation = dvHelper.createValidation(originalDv.getValidationConstraint(),
            appendingAddressList);
    newValidation.setSuppressDropDownArrow(originalDv.getSuppressDropDownArrow());
    newValidation.setShowErrorBox(originalDv.getShowErrorBox());
    newValidation.setShowPromptBox(originalDv.getShowPromptBox());
    newValidation.setEmptyCellAllowed(originalDv.getEmptyCellAllowed());
    newValidation.setErrorStyle(originalDv.getErrorStyle());
    String promptBoxText = originalDv.getPromptBoxText();
    String promptBoxTitle = originalDv.getPromptBoxTitle();
    String errorBoxText = originalDv.getErrorBoxText();
    String errorBoxTitle = originalDv.getErrorBoxTitle();
    if (promptBoxTitle != null && promptBoxText != null) {
        newValidation.createPromptBox(promptBoxTitle, promptBoxText);
    }
    if (errorBoxTitle != null && errorBoxText != null) {
        newValidation.createErrorBox(errorBoxTitle, errorBoxText);
    }
    sheet.addValidationData(newValidation);
}