本文整理汇总了Java中org.apache.wicket.markup.html.link.ResourceLink类的典型用法代码示例。如果您正苦于以下问题:Java ResourceLink类的具体用法?Java ResourceLink怎么用?Java ResourceLink使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ResourceLink类属于org.apache.wicket.markup.html.link包,在下文中一共展示了ResourceLink类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onInitialize
import org.apache.wicket.markup.html.link.ResourceLink; //导入依赖的package包/类
@Override
protected void onInitialize() {
super.onInitialize();
add(new ResourceLink<Void>("download", new ServerLogResourceReference()));
List<String> lines = ServerLogResource.readServerLog();
String content;
if (lines.size() > MAX_DISPLAY_LINES) {
add(new Label("warning", "Too many log entries, displaying recent " + MAX_DISPLAY_LINES));
content = Joiner.on("\n").join(lines.subList(lines.size()-MAX_DISPLAY_LINES, lines.size()));
} else {
add(new WebMarkupContainer("warning").setVisible(false));
content = Joiner.on("\n").join(lines);
}
add(new Label("logContent", content));
}
示例2: createSaveToExcelLink
import org.apache.wicket.markup.html.link.ResourceLink; //导入依赖的package包/类
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;
}
示例3: HomePageByteArray
import org.apache.wicket.markup.html.link.ResourceLink; //导入依赖的package包/类
public HomePageByteArray(final PageParameters parameters) throws IOException {
super(parameters);
setVersioned(false);
add(new ResourceLink<>("download", new ByteArrayResource("text/html"){
@Override
protected byte[] getData(Attributes attributes) {
try {
return IOUtils.toByteArray(WicketApplication.getInMemoryStream());
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
}));
}
示例4: addLogListView
import org.apache.wicket.markup.html.link.ResourceLink; //导入依赖的package包/类
private void addLogListView() {
add(new ListView<URI>("logs", resolveLogsURIs()) {
@Override
protected void populateItem(ListItem<URI> item) {
ResourceStreamResource lopZipStream = makeZipLogStream(item.getModel());
lopZipStream.setFileName("log.zip");
ResourceLink downloadLink = new ResourceLink("log", lopZipStream);
downloadLink.add(new Label("label", Paths.get(item.getModelObject()).getFileName().toString()));
item.add(downloadLink);
}
});
}
示例5: GuidelinesDialogContent
import org.apache.wicket.markup.html.link.ResourceLink; //导入依赖的package包/类
public GuidelinesDialogContent(String aId, final ModalWindow modalWindow,
final IModel<AnnotatorState> aModel)
{
super(aId);
// Overall progress by Projects
RepeatingView guidelineRepeater = new RepeatingView("guidelineRepeater");
add(guidelineRepeater);
for (String guidelineFileName : projectService
.listGuidelines(aModel.getObject().getProject())) {
AbstractItem item = new AbstractItem(guidelineRepeater.newChildId());
guidelineRepeater.add(item);
// Add a popup window link to display annotation guidelines
PopupSettings popupSettings = new PopupSettings(
PopupSettings.RESIZABLE | PopupSettings.SCROLLBARS).setHeight(500)
.setWidth(700);
IResourceStream stream = new FileResourceStream(projectService
.getGuideline(aModel.getObject().getProject(), guidelineFileName));
ResourceStreamResource resource = new ResourceStreamResource(stream);
ResourceLink<Void> rlink = new ResourceLink<>("guideine", resource);
rlink.setPopupSettings(popupSettings);
item.add(new Label("guidelineName", guidelineFileName));
item.add(rlink);
}
add(new LambdaAjaxLink("cancel", (target) -> modalWindow.close(target)));
}
示例6: getCsvLink
import org.apache.wicket.markup.html.link.ResourceLink; //导入依赖的package包/类
private ResourceLink<CsvResource> getCsvLink() {
return new ResourceLink<CsvResource>("csvExport", csvResource) {
@Override
public boolean isVisible() {
return !dataProvider.isEmpty();
}
};
}
示例7: getXlsLink
import org.apache.wicket.markup.html.link.ResourceLink; //导入依赖的package包/类
private ResourceLink<XlsResource> getXlsLink() {
return new ResourceLink<XlsResource>("xlsExport", xlsResource) {
@Override
public boolean isVisible() {
return !dataProvider.isEmpty();
}
};
}
示例8: getXlsxLink
import org.apache.wicket.markup.html.link.ResourceLink; //导入依赖的package包/类
private ResourceLink<XlsxResource> getXlsxLink() {
return new ResourceLink<XlsxResource>("xlsxExport", xlsxResource) {
@Override
public boolean isVisible() {
return !dataProvider.isEmpty();
}
};
}
示例9: getLink
import org.apache.wicket.markup.html.link.ResourceLink; //导入依赖的package包/类
public AbstractLink getLink(ActionContext context) {
List<Chart> charts = new ArrayList<Chart>();
for (Entity entity : context.getEntities()) {
charts.add((Chart)entity);
}
ChartResource download = new ChartResource(charts);
return new ResourceLink<ReportResource>(context.getLinkId(), download);
}
示例10: getLink
import org.apache.wicket.markup.html.link.ResourceLink; //导入依赖的package包/类
public AbstractLink getLink(ActionContext context) {
List<Report> reports = new ArrayList<Report>();
for (Entity entity : context.getEntities()) {
reports.add((Report)entity);
}
ReportResource download = new ReportResource(reports);
return new ResourceLink<ReportResource>(context.getLinkId(), download);
}
示例11: createSaveToExcelLink
import org.apache.wicket.markup.html.link.ResourceLink; //导入依赖的package包/类
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;
}
示例12: onInitialize
import org.apache.wicket.markup.html.link.ResourceLink; //导入依赖的package包/类
@Override
protected void onInitialize() {
super.onInitialize();
add(new Label("lines", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return context.getProject().getBlob(context.getBlobIdent()).getText().getLines().size() + " lines";
}
}) {
@Override
protected void onConfigure() {
super.onConfigure();
setVisible(context.getProject().getBlob(context.getBlobIdent()).getText() != null);
}
});
add(new Label("charset", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return context.getProject().getBlob(context.getBlobIdent()).getText().getCharset().displayName();
}
}) {
@Override
protected void onConfigure() {
super.onConfigure();
setVisible(context.getProject().getBlob(context.getBlobIdent()).getText() != null);
}
});
add(new Label("size", FileUtils.byteCountToDisplaySize(context.getProject().getBlob(context.getBlobIdent()).getSize())));
add(newOptions("options"));
add(new ResourceLink<Void>("raw", new RawBlobResourceReference(),
RawBlobResource.paramsOf(context.getProject(), context.getBlobIdent())));
add(new CheckBox("blame", Model.of(context.getMode() == Mode.BLAME)) {
@Override
protected void onConfigure() {
super.onConfigure();
setVisible(context.getProject().getBlob(context.getBlobIdent()).getText() != null);
}
}.add(new OnChangeAjaxBehavior() {
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
super.updateAjaxAttributes(attributes);
attributes.setMethod(Method.POST);
attributes.getAjaxCallListeners().add(new ConfirmLeaveListener());
attributes.getAjaxCallListeners().add(new TrackViewStateListener(true));
}
@Override
protected void onUpdate(AjaxRequestTarget target) {
if (context.getMode() == Mode.BLAME)
context.onModeChange(target, Mode.VIEW);
else
context.onModeChange(target, Mode.BLAME);
}
}));
add(newAdditionalActions("extraActions"));
newChangeActions(null);
setOutputMarkupId(true);
}
示例13: ImageCarouselPanel
import org.apache.wicket.markup.html.link.ResourceLink; //导入依赖的package包/类
public ImageCarouselPanel(String id, String diaporamaId) {
super(id);
this.diaporamaId = diaporamaId;
final MarkupContainer diaporamaContainer = new WebMarkupContainer("container");
diaporamaContainer.setOutputMarkupId(true);
add(diaporamaContainer);
List<DummyImageBean> imageBeans = Lists.newArrayList(
new DummyImageBean("logo_openwide.png", "widgets.carousel.openwide.header", "widgets.carousel.openwide.footer"),
new DummyImageBean("logo_sitra.jpg", "widgets.carousel.sitra.header", "widgets.carousel.sitra.footer"),
new DummyImageBean("logo_sytral.jpg", "widgets.carousel.sytral.header", "widgets.carousel.sytral.footer"),
new DummyImageBean("logo_vuitton.jpg", "widgets.carousel.vuitton.header", "widgets.carousel.vuitton.footer")
);
diaporamaContainer.add(new ListView<DummyImageBean>("imageItem", imageBeans) {
private static final long serialVersionUID = 4148116695921332880L;
@Override
protected void populateItem(ListItem<DummyImageBean> item) {
DummyImageBean imageBean = item.getModelObject();
Component header = new Label("header", new ResourceModel(imageBean.getHeaderLabelKey()));
header.setOutputMarkupId(true);
item.add(header);
WebMarkupContainer footer = new WebMarkupContainer("footer");
footer.add(new Label("footerLabel", new ResourceModel(imageBean.getFooterLabelKey())));
footer.setOutputMarkupId(true);
item.add(footer);
WebComponent image = new ContextImage("image", CONTEXT_RELATIVE_IMAGES_PATH + imageBean.getImagePath());
AbstractLink imageLink = new ResourceLink<Void>("imageLink",
new PackageResourceReference(MainTemplate.class, "images/" + imageBean.getImagePath()));
imageLink.add(new AttributeModifier("rel", ImageCarouselPanel.this.diaporamaId));
imageLink.add(new ModalHeaderFooterBehavior(header, footer));
imageLink.add(image);
item.add(imageLink);
}
});
final Component nextButton = new WebMarkupContainer("nextButton");
nextButton.setOutputMarkupId(true);
add(nextButton);
final Component prevButton = new WebMarkupContainer("prevButton");
prevButton.setOutputMarkupId(true);
add(prevButton);
diaporamaContainer.add(new CarouFredSelBehavior(getCarouFredSel(prevButton, nextButton)));
diaporamaContainer.add(new ModalDiaporamaBehavior("a[rel=" + ImageCarouselPanel.this.diaporamaId +"]", new Modal()));
}
示例14: initExportarComentarios
import org.apache.wicket.markup.html.link.ResourceLink; //导入依赖的package包/类
private void initExportarComentarios() {
add(new ResourceLink<Void>("exportarComentarios", new CSVComentariosResource()));
}
示例15: initExportarContribuicoes
import org.apache.wicket.markup.html.link.ResourceLink; //导入依赖的package包/类
private void initExportarContribuicoes() {
add(new ResourceLink<Void>("exportarContribuicoes", new CSVContribuicaoResource()));
}