use of com.manydesigns.elements.fields.PasswordField in project Portofino by ManyDesigns.
the class XlsUtil method addFieldToCell.
public void addFieldToCell(WritableSheet sheet, int i, int j, Field field) throws WriteException {
if (field instanceof NumericField) {
NumericField numField = (NumericField) field;
if (numField.getValue() != null) {
jxl.write.Number number;
BigDecimal decimalValue = numField.getValue();
if (numField.getDecimalFormat() == null) {
number = new Number(j, i, decimalValue.doubleValue());
} else {
number = new Number(j, i, decimalValue.doubleValue(), getNumberFormat(numField.getDecimalFormat().toPattern()));
}
sheet.addCell(number);
}
} else if (field instanceof PasswordField) {
Label label = new Label(j, i, PasswordField.PASSWORD_PLACEHOLDER);
sheet.addCell(label);
} else if (field instanceof DateField) {
DateField dateField = (DateField) field;
DateTime dateCell;
Date date = dateField.getValue();
if (date != null) {
dateCell = new DateTime(j, i, date, getDateFormat(dateField.getDatePattern()));
sheet.addCell(dateCell);
}
} else {
Label label = new Label(j, i, field.getStringValue());
sheet.addCell(label);
}
}
Aggregations