Java Code Examples for org.apache.wicket.markup.html.link.ResourceLink#add()

The following examples show how to use org.apache.wicket.markup.html.link.ResourceLink#add() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WidgetPopupMenuModel.java    From nextreports-server with Apache License 2.0 6 votes vote down vote up
private Link<TableResource> createSaveToExcelLink(final IModel<Widget> model) {
	ByteArrayResource download;
	if (model.getObject() instanceof PivotWidget) {
		PivotWidget pivotWidget = (PivotWidget)model.getObject();												
		download = new PivotResource(pivotWidget);		
	} else if (model.getObject() instanceof DrillDownWidget) {
		download = new TableResource(model.getObject().getId(), ((DrillDownWidget)model.getObject()).getDrillEntityContext());
	} else {
		download = new TableResource(model.getObject().getId(), null);
	}
	ResourceLink resourceLink =  new ResourceLink<TableResource>(MenuPanel.LINK_ID, download);
	// see busy-indicator.js
	// we do not want a busy indicator in this situation
	resourceLink.add(new AttributeAppender("class", new Model<String>("noBusyIndicator"), " "));
	return resourceLink;
}
 
Example 2
Source File: AuditTableRendererPanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
private Link<TableResource> createSaveToExcelLink(final IModel<TableData> model) {
	SimpleDateFormat sdf = new SimpleDateFormat("yyyy_MM_dd_HH-mm-ss");
	String fileName = "audit-" +  type.toLowerCase() + "-" + sdf.format(new Date()) + ".xls";
	ByteArrayResource download = new TableResource(excludeColumns(model.getObject()), fileName);		
	ResourceLink resourceLink =  new ResourceLink<TableResource>("download", download);
	// see busy-indicator.js
	// we do not want a busy indicator in this situation
	resourceLink.add(new AttributeAppender("class", new Model<String>("noBusyIndicator"), " "));
	return resourceLink;
}