我有一个方法,
private String createSubjectColumnForOutgoing(Message message)
{
//TODO : Changes for blocking messages of spam users
if(message.getReceiverEnvelope() != null && message.getReceiverEnvelope().getUser() != null && message.getReceiverEnvelope().getUser().isBlocked())
{
return I18N.IN_REVIEW_BY_TEAM.msg();
}
return StringUtils.deSanitizeSpecialCharacters(message.getSubject());
}
这个方法是这样调用的,
case OUTGOING:
table.addGeneratedColumn(I18N.MESSAGETABLE_HEADER_SUBJECT.msg(), this::createSubjectColumnForOutgoing);
break;
类中的构造函数是,
public MessageTable(Directory directory, boolean withFilter, Device device)
{
this(directory, new FilterConfiguration(withFilter), device);
}
public MessageTable(Directory directory, FilterConfiguration filterConfiguration, Device device)
{
Objects.requireNonNull(directory);
Objects.requireNonNull(device);
this.directory = directory;
dateTimeFormatter = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.SHORT).withLocale(LocaleAware.super.getLocale());
tableFooter = createTableFooter();
openButton = createOpenButton();
newButton = createNewButton();
messageTable = createTable(device);
tableFooter.addComponent(newButton, 0);
tableFooter.addComponent(openButton, 1);
final VerticalLayout layout = new VerticalLayout();
layout.addComponent(createFilterComponent(filterConfiguration));
layout.addComponents(tableFooter, messageTable);
layout.setComponentAlignment(tableFooter, Alignment.MIDDLE_LEFT);
rootLayout = layout;
setCompositionRoot(rootLayout);
}
调用此方法createSubjectColumnForOutgoing时没有传递任何参数,并且工作正常。我无法理解消息对象中数据的来源。我用谷歌搜索但无法理解。请帮忙。提前致谢。
addGeneratedColumn 的代码
public void addGeneratedColumn(Object id, Function<BEANTYPE, ?> generatedColumn)
{
String header = null;
if(id instanceof String)
{
header = (String) id;
}
addGeneratedColumn(header, id, (source, itemId, columnId) -> generatedColumn.apply(itemId));
}
慕容708150
相关分类