本文整理汇总了Java中org.apache.wicket.request.resource.IResource类的典型用法代码示例。如果您正苦于以下问题:Java IResource类的具体用法?Java IResource怎么用?Java IResource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IResource类属于org.apache.wicket.request.resource包,在下文中一共展示了IResource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AServerTitlePanel
import org.apache.wicket.request.resource.IResource; //导入依赖的package包/类
public AServerTitlePanel(final String id, final IResource logoModel, final IModel<String> badgeModel) {
super(id);
if (logoModel == null) {
add(new WebMarkupContainer("logo").setVisible(false));
} else {
final Image logo = new Image("logo", logoModel);
add(logo);
}
final Label badge = new Label("badge", badgeModel);
add(badge);
final Component link = newLink("link");
add(link);
final Component button = newButton("button");
add(button);
final Component crud = newCrudPanel("crud");
add(crud);
}
示例2: ACustomTitlePanel
import org.apache.wicket.request.resource.IResource; //导入依赖的package包/类
public ACustomTitlePanel(final String id, final IResource logoModel, final IModel<String> badgeModel) {
super(id);
if (logoModel == null) {
add(new WebMarkupContainer("logo").setVisible(false));
} else {
final Image logo = new Image("logo", logoModel);
add(logo);
}
final Label badge = new Label("badge", badgeModel);
add(badge);
final Component link = newLink("link");
add(link);
final Component button = newButton("button");
add(button);
}
示例3: isResourceAuthorized
import org.apache.wicket.request.resource.IResource; //导入依赖的package包/类
@Override
public boolean isResourceAuthorized(IResource resource,
PageParameters parameters) {
RequiredOrientResource[] resources = getRequiredOrientResources(resource.getClass());
if(resources!=null)
{
if(!checkResources(resources, Component.RENDER)) return false;
}
if(resource instanceof ISecuredComponent)
{
resources = ((ISecuredComponent)resource).getRequiredResources();
if(resources!=null)
{
if(!checkResources(resources, Component.RENDER)) return false;
}
}
return true;
}
示例4: ImageModalPanel
import org.apache.wicket.request.resource.IResource; //导入依赖的package包/类
public ImageModalPanel(final BaseModal<T> modal, final byte[] content, final PageReference pageRef) {
super(modal, pageRef);
Image image = new Image("image", new Model<IResource>()) {
private static final long serialVersionUID = -8457850449086490660L;
@Override
protected IResource getImageResource() {
return new DynamicImageResource() {
private static final long serialVersionUID = 923201517955737928L;
@Override
protected byte[] getImageData(final IResource.Attributes attributes) {
return content;
}
};
}
};
image.setOutputMarkupId(true);
add(image);
}
示例5: HtmlIFramePanel
import org.apache.wicket.request.resource.IResource; //导入依赖的package包/类
public HtmlIFramePanel(String id, final IModel<String> htmlModel) {
super(id);
IResource resource = new IResource() {
@Override
public void respond(Attributes attributes) {
WebResponse response = (WebResponse) attributes.getResponse();
response.setContentType("text/html; charset=utf-8");
response.write(htmlModel.getObject());
}
};
setResource(resource);
}
示例6: getResource
import org.apache.wicket.request.resource.IResource; //导入依赖的package包/类
@Override
public IResource getResource() {
ConcatBundleResource bundleResource = new ConcatBundleResource(getProvidedResources()) {
@Override
protected byte[] readAllResources(List<IResourceStream> resources)
throws IOException, ResourceStreamNotFoundException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
for (IResourceStream curStream : resources) {
IOUtils.copy(curStream.getInputStream(), output);
output.write(";".getBytes());
}
byte[] bytes = output.toByteArray();
if (getCompressor() != null) {
String nonCompressed = new String(bytes, "UTF-8");
bytes = getCompressor().compress(nonCompressed).getBytes("UTF-8");
}
return bytes;
}
};
ITextResourceCompressor compressor = getCompressor();
if (compressor != null) {
bundleResource.setCompressor(compressor);
}
return bundleResource;
}
示例7: getCategoryLogo
import org.apache.wicket.request.resource.IResource; //导入依赖的package包/类
@Hidden
public IResource getCategoryLogo() {
if (category.getLogo() != null) {
return new ByteArrayResource(null, category.getLogo(), category.getLogoFileName());
}
return null;
}
示例8: getApplicationLogo
import org.apache.wicket.request.resource.IResource; //导入依赖的package包/类
public IResource getApplicationLogo() {
if (applicationInstance.getApplication().getLogo() != null) {
return new ByteArrayResource(null, applicationInstance.getApplication().getLogo(),
applicationInstance.getApplication().getLogoFileName());
}
return null;
}
示例9: getResourceModel
import org.apache.wicket.request.resource.IResource; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
public IModel<IResource> getResourceModel() {
if (getType() == AnchorType.RESOURCE) {
return (IModel) super.getModel();
} else {
return null;
}
}
示例10: newLink
import org.apache.wicket.request.resource.IResource; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
protected ModelResourceLink newLink(final String componentId, final IModel<IResource> rowModel) {
return new ModelResourceLink(componentId, (IResource) getDataModel(rowModel).getObject(),
element.getTitleModel((IModel) rowModel)) {
@Override
protected void onComponentTag(final ComponentTag tag) {
tag.setName("a");
super.onComponentTag(tag);
}
};
}
示例11: EmbeddableImage
import org.apache.wicket.request.resource.IResource; //导入依赖的package包/类
public EmbeddableImage(String aComponentId, IResource aResource)
{
super(aComponentId);
add(new Image("image", aResource) {
private static final long serialVersionUID = 1L;
@Override
protected boolean shouldAddAntiCacheParameter()
{
return false;
}
});
}
示例12: mountResource
import org.apache.wicket.request.resource.IResource; //导入依赖的package包/类
/**
* Mount a resource.
*
* @param path The path of the resource.
* @param resource The resource itself
*/
private void mountResource(String path, final IResource resource) {
mountResource(path, new ResourceReference(path) {
@Override
public IResource getResource() {
return resource;
}
});
}
示例13: GalleryImageRenderer
import org.apache.wicket.request.resource.IResource; //导入依赖的package包/类
/**
* Creates a new instance of <code>GalleryImageRenderer</code>.
*/
public GalleryImageRenderer(String id, String imageResourceId) {
super(id);
if (imageResourceId == null) {
add(new ContextImage("img",new Model(ProfileConstants.UNAVAILABLE_IMAGE)));
return;
}
else if (sakaiProxy.getResource(imageResourceId) == null) {
// may have been deleted in CHS
add(new ContextImage("img",new Model(ProfileConstants.UNAVAILABLE_IMAGE)));
return;
}
final byte[] imageBytes = sakaiProxy.getResource(imageResourceId).getBytes();
if (imageBytes != null && imageBytes.length > 0) {
BufferedDynamicImageResource imageResource = new BufferedDynamicImageResource() {
private static final long serialVersionUID = 1L;
@Override
protected byte[] getImageData(IResource.Attributes ignored) {
return imageBytes;
}
};
Image myPic = new Image("img", new Model(imageResource));
myPic.add(new AttributeModifier("alt", new StringResourceModel("profile.gallery.image.alt",this,null).getString()));
add(myPic);
} else {
add(new ContextImage("img",new Model(ProfileConstants.UNAVAILABLE_IMAGE)));
}
}
示例14: JpegImage
import org.apache.wicket.request.resource.IResource; //导入依赖的package包/类
public JpegImage( String id )
{
super( id );
setImageResource( new DynamicImageResource()
{
/** Default serialVersionUID */
private static final long serialVersionUID = 1L;
protected byte[] getImageData( IResource.Attributes attributes )
{
return getPhoto();
}
} );
}
示例15: asReference
import org.apache.wicket.request.resource.IResource; //导入依赖的package包/类
public static ResourceReference asReference() {
return new ResourceReference(UserPictureResource.class.getCanonicalName()) {
@Override
public IResource getResource() {
return new UserPictureResource();
}
};
}