org.apache.wicket.request.resource.ResourceStreamResource Java Examples

The following examples show how to use org.apache.wicket.request.resource.ResourceStreamResource. 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: GuidelinesDialogContent.java    From webanno with Apache License 2.0 5 votes vote down vote up
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(RESIZABLE | 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)));
}
 
Example #2
Source File: FileSystemResource.java    From webanno with Apache License 2.0 5 votes vote down vote up
@Override
public void respond(Attributes attributes)
{
    FileResourceStream fileResourceStream = new FileResourceStream(file);
    ResourceStreamResource resource = new ResourceStreamResource(fileResourceStream);
    resource.respond(attributes);
}
 
Example #3
Source File: BirtImage.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
public IResource toResource() {
	try {
		if(source == IImage.URL_IMAGE) {
			return new ResourceStreamResource(new UrlResourceStream(new URL(getID())));
		} else if (source == IImage.FILE_IMAGE) {
			return new FileSystemResource( Paths.get(FileUtil.getURI(getID())));
		} else {
			return new ByteArrayResource(getMIMEType(), data);
		}
	} catch (MalformedURLException e) {
		throw new WicketRuntimeException("Can't transform to resource", e);
	}
}
 
Example #4
Source File: ExportCommand.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
@Override
protected AbstractLink newLink(String id) {
	IResource resource = new ResourceStreamResource()
	{
		@Override
		protected IResourceStream getResourceStream(Attributes attrs)
		{
			return new DataExportResourceStreamWriter(dataExporter, table);
		}
	}.setFileName(fileNameModel.getObject() + "." + dataExporter.getFileNameExtension());

	return new ResourceLink<Void>(id, resource);
}