aspose file tools*
The moose likes Java in General and the fly likes wicket DefaultDataTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "wicket DefaultDataTable" Watch "wicket DefaultDataTable" New topic
Author

wicket DefaultDataTable

ForzaMilan
Greenhorn

Joined: Jun 19, 2008
Posts: 2
I created a wicket DefaultDataTable showing my data. Now i need to edit every rows. How can i do this ??
Thank you very much.

Here my code :

....
ListSortableDataProvider provider = new ListSortableDataProvider(){
public void refresh(List list) {
list.clear();
list.addAll(storeService.loadControparti());
}
};

List<LinkPropertyColumn> columns = Arrays.asList(
new LinkPropertyColumn(new Model("Codice"), null, "tpCode"),
new LinkPropertyColumn(new Model("Descrizione"), null, "tpName"),
new LinkPropertyColumn(new Model("Codice Gruppo"), null, "tpGrpCode"),
new LinkPropertyColumn(new Model("Descrizione Gruppo"), null, "tpGrpName")
);

final DefaultDataTable ajaxTable = new DefaultDataTable("RequestTable", columns, provider, 20);
ajaxTable.add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(10)){
protected void onPostProcessTarget(AjaxRequestTarget target) {
target.addComponent(ajaxTable);
}
});
add(ajaxTable);
....
And the inner class :
class LinkPropertyColumn extends PropertyColumn {

PopupSettings popupSettings;
IModel labelModel;

public LinkPropertyColumn(IModel displayModel, String sortProperty,
String propertyExpression, PopupSettings popupSettings) {
this(displayModel, sortProperty, propertyExpression);
this.popupSettings = popupSettings;
}

public LinkPropertyColumn(IModel displayModel, IModel labelModel) {
super(displayModel, null);
this.labelModel = labelModel;
}

public LinkPropertyColumn(IModel displayModel, String sortProperty,
String propertyExpression) {
super(displayModel, sortProperty, propertyExpression);
}

public LinkPropertyColumn(IModel displayModel, String propertyExpressions) {
super(displayModel, propertyExpressions);
}

@Override
public void populateItem(Item item, String componentId, IModel model) {
item.add(new LinkPanel(item, componentId, model));
}

public void onClick(Item item, String componentId, IModel model) {
item.findParent(Item.class).getModel();
}


public class LinkPanel extends Panel {

public LinkPanel(final Item item, final String componentId,
final IModel model) {
super(componentId);

Link link = new Link("link") {

@Override
public void onClick() {
LinkPropertyColumn.this.onClick(item, componentId, model);
}
};

link.setPopupSettings(popupSettings);

add(link);

IModel tmpLabelModel = labelModel;


if (labelModel == null) {
tmpLabelModel = createLabelModel(model);
}
link.add(new Label("label", tmpLabelModel));
}
}
}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: wicket DefaultDataTable