if (!StringUtils.hasText(commandId)) {
return null;
}
ActionCommand printObjectCommand = new ActionCommand(commandId) {
@Override
protected void doExecuteCommand() {
Iterator<T> iter = new Iterator<T>() {
private ListSelectionModel sm = getSelectionModel();
private int max = sm.getMaxSelectionIndex();
private int index = sm.getMinSelectionIndex();
@Override
public boolean hasNext() {
if (sm.isSelectionEmpty())
return false;
for (; index <= max; index++) {
if (sm.isSelectedIndex(index))
return true;
}
return false;
}
@Override
public T next() {
if (hasNext())
return (T) getMasterEventList().get(index++);
throw new NoSuchElementException("No further elements were selected! Check this via hasNext before!");
}
@Override
public void remove() {
throw new UnsupportedOperationException("Not supported yet.");
}
};
printAction(iter);
}
};
String scid = constructSecurityControllerId(commandId);
printObjectCommand.setSecurityControllerId(scid);
return (ActionCommand) getCommandConfigurer().configure(printObjectCommand);
}