-
Notifications
You must be signed in to change notification settings - Fork 394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WICKET-6941 Add visible attribute to AbstractColumn to hide/show columns in DataTable/DataGridView #491
base: wicket-9.x
Are you sure you want to change the base?
WICKET-6941 Add visible attribute to AbstractColumn to hide/show columns in DataTable/DataGridView #491
Changes from 1 commit
4dd4735
3cb347a
84bd802
829ecb3
549b74e
062dd74
45ed67e
0b98ad3
02ebc6d
72304fc
73ef3af
c9a1656
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,4 +71,8 @@ public interface ICellPopulator<T> extends IClusterable, IDetachable | |
*/ | ||
void populateItem(final Item<ICellPopulator<T>> cellItem, final String componentId, | ||
final IModel<T> rowModel); | ||
|
||
boolean isVisible(); | ||
|
||
void setVisible(boolean visible); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As said I would prefer this to be only read-only |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,7 @@ public class PropertyPopulator<T> implements ICellPopulator<T> | |
{ | ||
private static final long serialVersionUID = 1L; | ||
private final String property; | ||
private boolean visible = true; | ||
|
||
/** | ||
* Constructor | ||
|
@@ -74,4 +75,16 @@ public void populateItem(final Item<ICellPopulator<T>> cellItem, final String co | |
{ | ||
cellItem.add(new Label(componentId, new PropertyModel<>(rowModel, property))); | ||
} | ||
|
||
@Override | ||
public boolean isVisible() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See my comment above. |
||
{ | ||
return visible; | ||
} | ||
|
||
@Override | ||
public void setVisible(boolean visible) | ||
{ | ||
this.visible = visible; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,8 @@ public abstract class AbstractColumn<T, S> implements IStyledColumn<T, S> | |
|
||
private final S sortProperty; | ||
|
||
private boolean visible = true; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See comment about read only |
||
|
||
/** | ||
* @param displayModel | ||
* model used to generate header text | ||
|
@@ -92,4 +94,16 @@ public String getCssClass() | |
{ | ||
return null; | ||
} | ||
|
||
@Override | ||
public boolean isVisible() | ||
{ | ||
return visible; | ||
} | ||
|
||
@Override | ||
public void setVisible(boolean visible) | ||
{ | ||
this.visible = visible; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,7 +71,10 @@ protected Iterator<IModel<IColumn<T, S>>> getItemModels() | |
|
||
for (IColumn<T, S> column : table.getColumns()) | ||
{ | ||
columnsModels.add(Model.of(column)); | ||
if (column.isVisible()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure this is the only involved toolbar that needs to be fixed... Did you run
? |
||
{ | ||
columnsModels.add(Model.of(column)); | ||
} | ||
} | ||
|
||
return columnsModels.iterator(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer this to be be
and no setter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also JavaDoc.