本文整理汇总了Java中org.apache.wicket.markup.html.link.DownloadLink类的典型用法代码示例。如果您正苦于以下问题:Java DownloadLink类的具体用法?Java DownloadLink怎么用?Java DownloadLink使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DownloadLink类属于org.apache.wicket.markup.html.link包,在下文中一共展示了DownloadLink类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildGui
import org.apache.wicket.markup.html.link.DownloadLink; //导入依赖的package包/类
private void buildGui() {
final EntityCollectionModel model = getModel();
final NotificationPanel feedback = new NotificationPanel(ID_FEEDBACK);
feedback.setOutputMarkupId(true);
addOrReplace(feedback);
final LoadableDetachableModel<File> fileModel = new ExcelFileModel(model);
final String xlsxFileName = xlsxFileNameFor(model);
final DownloadLink link = new ExcelFileDownloadLink(ID_DOWNLOAD, fileModel, xlsxFileName);
addOrReplace(link);
}
示例2: HomePageTmpFile
import org.apache.wicket.markup.html.link.DownloadLink; //导入依赖的package包/类
public HomePageTmpFile(final PageParameters parameters) throws IOException {
super(parameters);
setVersioned(false);
add(new DownloadLink("download", new LoadableDetachableModel<File>(){
@Override
protected File load() {
Path p;
try {
p = Files.createTempFile("google", "html");
Files.copy(WicketApplication.getInMemoryStream(), p, StandardCopyOption.REPLACE_EXISTING);
return p.toFile();
} catch (IOException e) {
return null;
}
}
}, Model.of("google.html")).setDeleteAfterDownload(true));
}
示例3: DownloadLinkHolder
import org.apache.wicket.markup.html.link.DownloadLink; //导入依赖的package包/类
public DownloadLinkHolder(String id, File file, String fileName) {
super(id);
DownloadLink downloadLink = new DownloadLink("downloadLink", file);
add(downloadLink);
downloadLink.add(new Label("fileName", fileName));
}
示例4: Index
import org.apache.wicket.markup.html.link.DownloadLink; //导入依赖的package包/类
public Index(String app) {
setVersioned(false);
final String theApp = LogService.isAppRegistered(app) ? app : null;
serverDate = new Label("serverDate", LogService.getFormattedDate(new Date()));
serverDate.setOutputMarkupId(true);
add(new Label("title", theApp != null ? String.format("[%s]@Web4Log", theApp) : "Web4Log"));
add(new Label("headerLabel", ConfigService.getString("header.label")));
add(serverDate);
appListContainer = new WebMarkupContainer("appListContainer");
appListContainer.setOutputMarkupId(true);
add(appListContainer);
appListContainer.add(new ListView<AppInfo>("appList", LogService.getAppList()) {
@Override
protected void populateItem(final ListItem<AppInfo> item) {
final AppInfo anAppInfo = item.getModelObject();
WebComponent stat = new WebComponent("stat");
stat.add(new AttributeModifier("class", anAppInfo.isConnected() ? "fa fa-link" : "fa fa-chain-broken"));
stat.add(new AttributeModifier("style", String.format("color:%s;", anAppInfo.isConnected() ? "#8aff27" : "red")));
Label selectedAppLbl = new Label("selectedApp", anAppInfo.getName());
Link<String> appLink = new Link<String>("appLink") {
@Override
public void onClick() {
setResponsePage(new Index(anAppInfo.getName()));
}
};
appLink.add(new Label("appLinkLabel", anAppInfo.getName()));
selectedAppLbl.setVisible(anAppInfo.getName().equals(theApp));
appLink.setVisible(!selectedAppLbl.isVisible());
item.add(stat);
item.add(selectedAppLbl);
item.add(appLink);
item.add(new DownloadLink("downloadLogFile", new File(LogService.getLogFileLocation(anAppInfo.getName())))
.setCacheDuration(Duration.NONE));
}
});
add(
new TailRemoteLogPanel("tailPanel")
.setRemoteApp(theApp)
.setVisible(theApp != null)
);
add(new AbstractAjaxTimerBehavior(Duration.ONE_MINUTE) {
@Override
protected void onTimer(AjaxRequestTarget target) {
serverDate.setDefaultModel(new Model<Serializable>(LogService.getFormattedDate(new Date())));
target.add(serverDate);
}
});
}
示例5: createFileDownload
import org.apache.wicket.markup.html.link.DownloadLink; //导入依赖的package包/类
@Override
public Component createFileDownload(FileDownloadElement e) {
IModel<File> model = e.getModel();
DownloadLink downloadLink = new DownloadLink(e.getWicketId(), model);
return downloadLink;
}
示例6: onInitialize
import org.apache.wicket.markup.html.link.DownloadLink; //导入依赖的package包/类
@Override
public void onInitialize() {
super.onInitialize();
//get list of assignments. this allows us to build the columns and then fetch the grades for each student for each assignment from the map
assignments = businessService.getGradebookAssignments();
//get the grade matrix
grades = businessService.buildGradeMatrix(assignments);
add(new DownloadLink("downloadFullGradebook", new LoadableDetachableModel<File>() {
@Override
protected File load() {
return buildFile(true);
}
}).setCacheDuration(Duration.NONE).setDeleteAfterDownload(true));
add(new UploadForm("form"));
}
示例7: LinkPanel
import org.apache.wicket.markup.html.link.DownloadLink; //导入依赖的package包/类
LinkPanel(String id, IModel<File> file, IModel<String> type, IModel<String> name) {
super(id);
add(new DownloadLink("file", file, name).setBody(new FileNameAndFormatAndSizeModel(file, type, name)));
}