Class GridColumn
java.lang.Object
com.codename1.ui.table.GridColumn
One column of a DataGrid: which column of the model it shows, its
title and width, and how its values are painted, compared and edited.
A column is a description, not a component. Changing one after it was
added to a grid takes effect on the grid's next layout; call
DataGrid#refresh() to ask for it.
GridColumn price = new GridColumn(2, "Price")
.setKind(GridColumn.Kind.NUMBER)
.setWidthMM(22)
.setAggregate(GridAggregate.SUM);
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumWhat a column holds, which decides how it is aligned, compared and edited. -
Constructor Summary
ConstructorsConstructorDescriptionGridColumn(int modelColumn, String title) A column showing columnmodelColumnof the model, titledtitle. -
Method Summary
Modifier and TypeMethodDescriptionintCompares two values withgetComparator()or the default order.The text a value is shown as.What a group row shows in this column, or null for nothing.intThe alignment of the values:Component.LEFT,CENTERorRIGHT, or -1 to align by kind.Object[]The values aCHOICEcolumn picks from.How two values of the column are ordered, or null for the default order: numbers by value, dates by time, booleans false first, and everything else by its text, ignoring case.The editor of the cells, or null for the grid's default.intgetFlex()The share of the width left over when the columns are narrower than the grid; 0, the default, takes none.How values are turned into text, or null for the default.getKind()What the column holds.floatThe widest the column sizes itself to what it shows, in millimetres.floatThe narrowest a resize may make the column, in millimetres.intThe column of the model this column shows.The renderer of the cells, or null for the grid's default.getTitle()The text in the header.floatThe width asked for, in millimetres; 0 sizes the column to its title and the first rows.booleanWhether the column's cells may be edited.booleanWhether the header can be dragged to move the column.booleanWhether the edge of the header can be dragged to resize the column.booleanWhether a tap on the header sorts by this column.booleanWhether the column is shown.intresolveAlignment(Object value) The alignment a value is painted with, fromgetAlignment()or the value's kind.resolveKind(Object value) The kind of one value: the column's kind, or the value's own when the column's isAUTO.setAggregate(GridAggregate aggregate) Sets what a group row shows in this column, such asGridAggregate.SUM.setAlignment(int alignment) Sets the alignment of the values; -1, the default, right aligns numbers, centres check boxes and left aligns the rest.setChoices(Object... choices) Sets the values aCHOICEcolumn picks from, and makes it one.setComparator(Comparator<Object> comparator) Sets how two values of the column are ordered.setEditable(boolean editable) Sets whether the column's cells may be edited.setEditor(GridCellEditor editor) Sets the editor of the cells; null uses the grid's default.setFlex(int flex) Sets the share of the left over width this column takes.setFormatter(GridFormatter formatter) Sets how values are turned into text and read back from it.setKind(GridColumn.Kind kind) Sets what the column holds;AUTOby default.setMaxWidthMM(float maxWidthMM) Sets the widest the column sizes itself to what it shows, in millimetres.setMinWidthMM(float minWidthMM) Sets the narrowest a resize may make the column, in millimetres.setMovable(boolean movable) Sets whether the header can be dragged to move the column.setRenderer(GridCellRenderer renderer) Sets the renderer of the cells; null uses the grid's default.setResizable(boolean resizable) Sets whether the column can be resized by dragging its header edge.setSortable(boolean sortable) Sets whether a tap on the header sorts by this column.Sets the text in the header.setVisible(boolean visible) Shows or hides the column.setWidthMM(float widthMM) Sets the width, in millimetres; 0, the default, sizes the column to what it shows.
-
Constructor Details
-
GridColumn
A column showing columnmodelColumnof the model, titledtitle.
-
-
Method Details
-
getModelColumn
public int getModelColumn()The column of the model this column shows. -
getTitle
The text in the header. -
setTitle
Sets the text in the header. -
getKind
What the column holds. -
setKind
Sets what the column holds;AUTOby default. -
getWidthMM
public float getWidthMM()The width asked for, in millimetres; 0 sizes the column to its title and the first rows. -
setWidthMM
Sets the width, in millimetres; 0, the default, sizes the column to what it shows. -
getMinWidthMM
public float getMinWidthMM()The narrowest a resize may make the column, in millimetres. -
setMinWidthMM
Sets the narrowest a resize may make the column, in millimetres. -
getMaxWidthMM
public float getMaxWidthMM()The widest the column sizes itself to what it shows, in millimetres. -
setMaxWidthMM
Sets the widest the column sizes itself to what it shows, in millimetres. A resize by the user may go past it. -
getFlex
public int getFlex()The share of the width left over when the columns are narrower than the grid; 0, the default, takes none. -
setFlex
Sets the share of the left over width this column takes. -
getAlignment
public int getAlignment()The alignment of the values:Component.LEFT,CENTERorRIGHT, or -1 to align by kind. -
setAlignment
Sets the alignment of the values; -1, the default, right aligns numbers, centres check boxes and left aligns the rest. -
resolveAlignment
The alignment a value is painted with, fromgetAlignment()or the value's kind. -
resolveKind
The kind of one value: the column's kind, or the value's own when the column's isAUTO. -
isSortable
public boolean isSortable()Whether a tap on the header sorts by this column. -
setSortable
Sets whether a tap on the header sorts by this column. -
isResizable
public boolean isResizable()Whether the edge of the header can be dragged to resize the column. -
setResizable
Sets whether the column can be resized by dragging its header edge. -
isMovable
public boolean isMovable()Whether the header can be dragged to move the column. -
setMovable
Sets whether the header can be dragged to move the column. -
isEditable
public boolean isEditable()Whether the column's cells may be edited. A cell is edited only when the column and the model both allow it. -
setEditable
Sets whether the column's cells may be edited. -
isVisible
public boolean isVisible()Whether the column is shown. -
setVisible
Shows or hides the column. A hidden column keeps its place. -
getRenderer
The renderer of the cells, or null for the grid's default. -
setRenderer
Sets the renderer of the cells; null uses the grid's default. -
getEditor
The editor of the cells, or null for the grid's default. -
setEditor
Sets the editor of the cells; null uses the grid's default. -
getFormatter
How values are turned into text, or null for the default. -
setFormatter
Sets how values are turned into text and read back from it. -
format
-
getComparator
How two values of the column are ordered, or null for the default order: numbers by value, dates by time, booleans false first, and everything else by its text, ignoring case. -
setComparator
Sets how two values of the column are ordered. It is never given a null: nulls sort first. -
compare
-
getAggregate
What a group row shows in this column, or null for nothing. -
setAggregate
Sets what a group row shows in this column, such asGridAggregate.SUM. -
getChoices
The values aCHOICEcolumn picks from. -
setChoices
Sets the values aCHOICEcolumn picks from, and makes it one.
-