public class EachCommand extends AbstractCommand
Implements iteration over collection or array of items
The variables defined in 'var' and 'varIndex' will be saved using the special method Context.getRunVar()
Modifier and Type | Class and Description |
---|---|
static class |
EachCommand.Direction |
Modifier and Type | Field and Description |
---|---|
static String |
COMMAND_NAME |
ADJACENT_SHIFT_MODE, INNER_SHIFT_MODE
Constructor and Description |
---|
EachCommand() |
EachCommand(String items,
Area area) |
EachCommand(String var,
String items,
Area area) |
EachCommand(String var,
String items,
Area area,
CellRefGenerator cellRefGenerator) |
EachCommand(String var,
String items,
Area area,
EachCommand.Direction direction) |
EachCommand(String var,
String items,
EachCommand.Direction direction) |
Modifier and Type | Method and Description |
---|---|
Command |
addArea(Area area)
Adds an area to this command
|
Size |
applyAt(CellRef cellRef,
Context context)
Applies a command at the given cell reference
|
CellRefGenerator |
getCellRefGenerator()
Gets defined cell ref generator
|
EachCommand.Direction |
getDirection()
Gets iteration direction
|
String |
getGroupBy() |
String |
getGroupOrder() |
String |
getItems()
Gets collection bean name
|
String |
getMultisheet() |
String |
getName() |
String |
getOrderBy() |
String |
getSelect()
Gets current 'select' expression for filtering out collection items
|
String |
getVar()
Gets current variable name for collection item in the context during iteration
|
String |
getVarIndex() |
boolean |
isOldSelectBehavior() |
void |
setCellRefGenerator(CellRefGenerator cellRefGenerator) |
void |
setDirection(EachCommand.Direction direction)
Sets iteration direction
|
void |
setDirection(String direction) |
void |
setGroupBy(String groupBy) |
void |
setGroupOrder(String groupOrder) |
void |
setItems(String items)
Sets collection bean name
|
void |
setMultisheet(String multisheet)
Sets name of context variable holding a list of Excel sheet names to output the collection to
|
void |
setOldSelectBehavior(boolean oldSelectBehavior) |
void |
setOrderBy(String orderBy) |
void |
setSelect(String select)
Sets current 'select' expression for filtering collection
|
void |
setVar(String var)
Sets current variable name for collection item in the context during iteration
|
void |
setVarIndex(String varIndex) |
getAreaList, getLockRange, getShiftMode, getTransformationConfig, getTransformer, reset, setLockRange, setLockRange, setShiftMode
public static final String COMMAND_NAME
public EachCommand()
public EachCommand(String var, String items, EachCommand.Direction direction)
var
- name of the key in the context to contain each collection items during iterationitems
- name of collection or array in the contextdirection
- defines processing by rows (DOWN - default) or columns (RIGHT)public EachCommand(String var, String items, Area area, EachCommand.Direction direction)
public EachCommand(String var, String items, Area area, CellRefGenerator cellRefGenerator)
var
- name of the key in the context to contain each collection items during iterationitems
- name of collection or array in the contextarea
- body area for this commandcellRefGenerator
- generates target cell ref for each collection item during iterationpublic String getName()
public String getItems()
public void setItems(String items)
items
- name of collection or array in the contextpublic String getVar()
public void setVar(String var)
var
- name of the loop varpublic String getVarIndex()
public void setVarIndex(String varIndex)
public EachCommand.Direction getDirection()
public void setDirection(EachCommand.Direction direction)
direction
- iteration directionpublic void setDirection(String direction)
direction
- "DOWN" or "RIGHT"public String getSelect()
public void setSelect(String select)
select
- filtering expressionpublic String getGroupBy()
public void setGroupBy(String groupBy)
groupBy
- property name for grouping the collection.
You should write the run var name + "." before the property name.public String getGroupOrder()
public void setGroupOrder(String groupOrder)
groupOrder
- group ordering: "ASC" for ascending, "DESC" for descending, other value or null: no sorting. Case does not matter.public void setOrderBy(String orderBy)
orderBy
- property names for ordering the list.
You should write the run var name + "." before each property name.
You can write " ASC" or " DESC" after each property name for ascending/descending sorting order. ASC is the default.public String getOrderBy()
public String getMultisheet()
public void setMultisheet(String multisheet)
multisheet
- var namepublic CellRefGenerator getCellRefGenerator()
CellRefGenerator
instance or nullpublic void setCellRefGenerator(CellRefGenerator cellRefGenerator)
public boolean isOldSelectBehavior()
public void setOldSelectBehavior(boolean oldSelectBehavior)
public Command addArea(Area area)
Command
addArea
in interface Command
addArea
in class AbstractCommand
area
- to be added areapublic Size applyAt(CellRef cellRef, Context context)
Command
cellRef
- cell reference where the command must be appliedcontext
- bean context to useCopyright © 2023. All rights reserved.