本文整理汇总了Java中org.apache.wicket.request.resource.ResourceReference类的典型用法代码示例。如果您正苦于以下问题:Java ResourceReference类的具体用法?Java ResourceReference怎么用?Java ResourceReference使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ResourceReference类属于org.apache.wicket.request.resource包,在下文中一共展示了ResourceReference类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: includeSoleDependencies
import org.apache.wicket.request.resource.ResourceReference; //导入依赖的package包/类
private Set<ResourceReference> includeSoleDependencies(Set<ResourceReference> dependents) {
while (true) {
Set<ResourceReference> newDependents = new HashSet<>(dependents);
for (ResourceReference dependent: dependents) {
for (ResourceReference dependency: dependencyMap.get(dependent).getDependencies()) {
if (!dependency.getClass().isAnnotationPresent(ResourceBundle.class)
&& dependents.containsAll(dependentMap.get(dependency))) {
newDependents.add(dependency);
}
}
}
if (!newDependents.equals(dependents)) {
dependents = newDependents;
} else {
break;
}
}
return dependents;
}
示例2: ImageModel
import org.apache.wicket.request.resource.ResourceReference; //导入依赖的package包/类
/**
* The constructor for this class, which provides the images for the web
* application.
*
* @param component
*/
public ImageModel(final Component component) {
final SharedResources sharedResources = WebApplication.get().getSharedResources();
final ResourceReference aligmentImageReference = sharedResources.get(ImageReference.class, "alignment.jpg", null, null, null, false);
final ResourceReference eventStreamImageReference = sharedResources.get(ImageReference.class, "eventStream.jpg", null, null, null, false);
final ResourceReference groupImageReference = sharedResources.get(ImageReference.class, "group.jpg", null, null, null, false);
final ResourceReference processImageReference = sharedResources.get(ImageReference.class, "process.jpg", null, null, null, false);
this.images.add(new CarouselImage(component.getRequestCycle().urlFor(eventStreamImageReference, null).toString(), "Event streaming platform", "Capture all your event streams in one platform"));
this.images.add(new CarouselImage(component.getRequestCycle().urlFor(groupImageReference, null).toString(), "Next generation process management", "Monitor and analyze your processes"));
this.images.add(new CarouselImage(component.getRequestCycle().urlFor(processImageReference, null).toString(), "Process optimization", "Capture running process instances to optimize them"));
this.images.add(new CarouselImage(component.getRequestCycle().urlFor(aligmentImageReference, null).toString(), "Business and IT alignment", "Gain knowlegde through combining business and IT"));
}
示例3: preloadStyleSheets
import org.apache.wicket.request.resource.ResourceReference; //导入依赖的package包/类
protected void preloadStyleSheets(ResourceReference... resourcesReferences) {
for (ResourceReference resourceReference : resourcesReferences) {
LOGGER.info("Preloading stylesheet '{}/{}'...", resourceReference.getScope().getName(),
resourceReference.getName());
IResourceStream resourceStream = null;
try {
// Just initialize the underlying cache, whatever the content is.
resourceStream = ((PackageResource) resourceReference.getResource()).getResourceStream();
} finally {
if (resourceStream != null) {
try {
resourceStream.close();
} catch (IOException e) {
LOGGER.error("Error when closing a stream while trying to preload stylesheets.", e);
}
}
}
}
}
示例4: early
import org.apache.wicket.request.resource.ResourceReference; //导入依赖的package包/类
public static <TEarlyTargetDefinitionLinkDescriptor, TEarlyTarget>
BuilderTargetFactories<
TEarlyTargetDefinitionLinkDescriptor, TEarlyTarget,
Void, Void, Void
> early(IBuilderLinkDescriptorFactory<TEarlyTarget, TEarlyTargetDefinitionLinkDescriptor> factory,
IModel<? extends TEarlyTarget> earlyTargetModel) {
return new BuilderTargetFactories<
TEarlyTargetDefinitionLinkDescriptor, TEarlyTarget,
Void, Void, Void
>(
factory, earlyTargetModel,
BuilderLinkDescriptorFactory.<Class<? extends Page>>none(),
BuilderLinkDescriptorFactory.<ResourceReference>none(),
BuilderLinkDescriptorFactory.<ResourceReference>none()
);
}
示例5: BuilderTargetFactories
import org.apache.wicket.request.resource.ResourceReference; //导入依赖的package包/类
private BuilderTargetFactories(
IBuilderLinkDescriptorFactory<TEarlyTarget, TEarlyTargetDefinitionLinkDescriptor>
earlyTargetDefinitionLinkDescriptorFactory,
IModel<? extends TEarlyTarget> earlyTargetDefinitionTargetModel,
IBuilderLinkDescriptorFactory<
Class<? extends Page>, TLateTargetDefinitionPageLinkDescriptor
> lateTargetDefinitionPageLinkDescriptorFactory,
IBuilderLinkDescriptorFactory<
ResourceReference, TLateTargetDefinitionResourceLinkDescriptor
> lateTargetDefinitionResourceLinkDescriptorFactory,
IBuilderLinkDescriptorFactory<
ResourceReference, TLateTargetDefinitionImageResourceLinkDescriptor
> lateTargetDefinitionImageResourceLinkDescriptorFactory) {
super();
this.earlyTargetDefinitionLinkDescriptorFactory = earlyTargetDefinitionLinkDescriptorFactory;
this.earlyTargetDefinitionTargetModel = earlyTargetDefinitionTargetModel;
this.lateTargetDefinitionPageLinkDescriptorFactory = lateTargetDefinitionPageLinkDescriptorFactory;
this.lateTargetDefinitionResourceLinkDescriptorFactory = lateTargetDefinitionResourceLinkDescriptorFactory;
this.lateTargetDefinitionImageResourceLinkDescriptorFactory = lateTargetDefinitionImageResourceLinkDescriptorFactory;
}
示例6: apply
import org.apache.wicket.request.resource.ResourceReference; //导入依赖的package包/类
@Override
protected <T> IOneParameterLinkDescriptorMapper<? extends ILinkDescriptor, T>
buildWithParameterDependentTarget(IOneChosenParameterState<
?,
T,
IOneParameterLinkDescriptorMapper<IPageLinkDescriptor, T>,
IOneParameterLinkDescriptorMapper<IResourceLinkDescriptor, T>,
IOneParameterLinkDescriptorMapper<IImageResourceLinkDescriptor, T>
> builder) {
return builder.imageResource(DetachableFactories.forUnit(ReadOnlyModel.factory(
new SerializableFunction<T, ResourceReference>() {
private static final long serialVersionUID = 1L;
@Override
public ResourceReference apply(T input) {
return input == null
? TestLinkDescriptorNoParameterResource.REFERENCE
: TestLinkDescriptorOneParameterResource.REFERENCE;
}
}
)));
}
示例7: apply
import org.apache.wicket.request.resource.ResourceReference; //导入依赖的package包/类
@Override
protected <T> IOneParameterLinkDescriptorMapper<? extends ILinkDescriptor, T>
buildWithParameterDependentTarget(IOneChosenParameterState<
?,
T,
IOneParameterLinkDescriptorMapper<IPageLinkDescriptor, T>,
IOneParameterLinkDescriptorMapper<IResourceLinkDescriptor, T>,
IOneParameterLinkDescriptorMapper<IImageResourceLinkDescriptor, T>
> builder) {
return builder.resource(DetachableFactories.forUnit(ReadOnlyModel.factory(
new SerializableFunction<T, ResourceReference>() {
private static final long serialVersionUID = 1L;
@Override
public ResourceReference apply(T input) {
return input == null
? TestLinkDescriptorNoParameterResource.REFERENCE
: TestLinkDescriptorOneParameterResource.REFERENCE;
}
}
)));
}
示例8: create
import org.apache.wicket.request.resource.ResourceReference; //导入依赖的package包/类
@Override
public ResourceReference create(Key key) {
if (PackageResource.exists(key)) {
return new PackageResourceReference(key);
} else {
for (ConcatResourceBundleReference<? extends IReferenceHeaderItem> bundle: bundles) {
if (bundle.getScope().getName().equals(key.getScope())) {
String bundleParentPath = getParentPath(bundle.getName());
String relativePath;
if (bundleParentPath != null)
relativePath = PathUtils.relativize(bundleParentPath, key.getName());
else
relativePath = key.getName();
for (IReferenceHeaderItem headerItem: bundle.getProvidedResources()) {
String referenceParentPath = getParentPath(headerItem.getReference().getName());
String possibleName;
if (referenceParentPath != null)
possibleName = PathUtils.resolve(referenceParentPath, relativePath);
else
possibleName = relativePath.toString();
possibleName = PathUtils.normalize(possibleName);
if (possibleName != null) {
Key possibleKey = new Key(headerItem.getReference().getScope().getName(), possibleName,
key.getLocale(), key.getStyle(), key.getVariation());
if (PackageResource.exists(possibleKey)) {
return new PackageResourceReference(possibleKey);
}
}
}
}
}
return null;
}
}
示例9: createBundles
import org.apache.wicket.request.resource.ResourceReference; //导入依赖的package包/类
private void createBundles(Class<?> scope, Set<ResourceReference> resourceReferences) {
/*
* Some bundled css file may contain resources relative to parent paths of the css url,
* for instance, a css may define below style:
*
* background: url(../images/clock.png)),
*
* if we use a resource name for instance "bundle" here, the generated resource
* path will be something like "http://<server>:<port>/wicket/resource/org.apache.wicket.Application/bundle-ver-1472816165384.css",
* and browser will resolve image url above as "http://<server>:<port>/wicket/resource/images/clock.png", which will cause Wicket
* resource loading not working at all. However if we use a long path here for resource name, for instance
* "a/l/o/n/g/p/a/t/h/bundle", the resolved image url will be "http://<server>:<port>/wicket/resource/org.apache.wicket.Application/a/l/o/n/g/p/a/t/clock.png",
* which will be resolved to the correct image with help of our BundleAwareResourceReferenceFactory
*/
String name = "a/l/o/n/g/p/a/t/h/bundle";
List<ResourceReference> resourceReferenceList = new ArrayList<>(resourceReferences);
resourceReferenceList.sort((o1, o2)->sorted.indexOf(o1)-sorted.indexOf(o2));
List<JavaScriptReferenceHeaderItem> javaScriptResourceReferences = new ArrayList<>();
List<CssReferenceHeaderItem> cssResourceReferences = new ArrayList<>();
for (ResourceReference resourceReference: resourceReferenceList) {
if (resourceReference instanceof JavaScriptResourceReference) {
javaScriptResourceReferences.add(JavaScriptReferenceHeaderItem.forReference(resourceReference));
} else if (resourceReference instanceof CssResourceReference) {
cssResourceReferences.add(CssReferenceHeaderItem.forReference(resourceReference));
}
}
if (!javaScriptResourceReferences.isEmpty()) {
javaScriptBundleReferences.add(new JavaScriptConcatResourceBundleReference(
scope, name + ".js", javaScriptResourceReferences));
}
if (!cssResourceReferences.isEmpty()) {
cssBundleReferences.add(new CachedDependenciesConcatResourceBundleReference<CssReferenceHeaderItem>(
scope, name + ".css", cssResourceReferences));
}
}
示例10: getDependencyAware
import org.apache.wicket.request.resource.ResourceReference; //导入依赖的package包/类
private DependencyAware<ResourceReference> getDependencyAware(ResourceReference resource) {
return new DependencyAware<ResourceReference>() {
@Override
public ResourceReference getId() {
return resource;
}
@Override
public int hashCode() {
return getId().hashCode();
}
@SuppressWarnings("unchecked")
@Override
public boolean equals(Object obj) {
return getId().equals(((DependencyAware<ResourceReference>)obj).getId());
}
@Override
public Set<ResourceReference> getDependencies() {
Set<ResourceReference> dependencies = new LinkedHashSet<>();
for (HeaderItem item: resource.getDependencies()) {
if (item instanceof IReferenceHeaderItem) {
ResourceReference reference = ((IReferenceHeaderItem) item).getReference();
if (reference.canBeRegistered()) {
dependencies.add(reference);
}
}
}
return dependencies;
}
};
}
示例11: PrismObjectPanel
import org.apache.wicket.request.resource.ResourceReference; //导入依赖的package包/类
public PrismObjectPanel(String id, IModel<ObjectWrapper<O>> model, ResourceReference image, Form<ObjectWrapper<O>> form, PageBase pageBase) {
super(id);
setOutputMarkupId(true);
LOGGER.trace("Creating object panel for {}", model.getObject());
this.pageBase = pageBase;
initLayout(model, image, form);
}
示例12: mountImages
import org.apache.wicket.request.resource.ResourceReference; //导入依赖的package包/类
/**
* Loads the images for the web application at start-up.
*/
private void mountImages() {
final ResourceReference alignmentImage = new PackageResourceReference(ImageReference.class, "alignment.jpg");
this.mountResource("/images/alignment", alignmentImage);
final ResourceReference eventStreamImage = new PackageResourceReference(ImageReference.class, "eventStream.jpg");
this.mountResource("/images/eventStream", eventStreamImage);
final ResourceReference groupImage = new PackageResourceReference(ImageReference.class, "group.jpg");
this.mountResource("/images/group", groupImage);
final ResourceReference processImage = new PackageResourceReference(ImageReference.class, "process.jpg");
this.mountResource("/images/process", processImage);
}
示例13: getObject
import org.apache.wicket.request.resource.ResourceReference; //导入依赖的package包/类
@Override
public ResourceReference getObject() {
Boolean aBoolean = booleanModel.getObject();
if (aBoolean != null && aBoolean) {
return IMAGE_TRUE;
} else {
return null;
}
}
示例14: image
import org.apache.wicket.request.resource.ResourceReference; //导入依赖的package包/类
@Override
public DynamicImage image(String wicketId) {
return new DynamicImage(
wicketId, Models.<ResourceReference>placeholder(),
Models.<PageParameters>placeholder(),
new ConditionLinkParameterValidator(Condition.alwaysFalse())
);
}
示例15: DynamicImage
import org.apache.wicket.request.resource.ResourceReference; //导入依赖的package包/类
public DynamicImage(
String wicketId,
IModel<? extends ResourceReference> resourceReferenceModel,
IModel<PageParameters> parametersMapping,
ILinkParameterValidator parametersValidator) {
super(wicketId);
Args.notNull(resourceReferenceModel, "resourceReferenceModel");
this.resourceReferenceModel = wrap(resourceReferenceModel);
this.parametersMapping = parametersMapping;
this.parametersValidator = parametersValidator;
}