本文整理汇总了Java中org.apache.wicket.markup.html.image.Image类的典型用法代码示例。如果您正苦于以下问题:Java Image类的具体用法?Java Image怎么用?Java Image使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Image类属于org.apache.wicket.markup.html.image包,在下文中一共展示了Image类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AServerTitlePanel
import org.apache.wicket.markup.html.image.Image; //导入依赖的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.markup.html.image.Image; //导入依赖的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: renderImage
import org.apache.wicket.markup.html.image.Image; //导入依赖的package包/类
public Image renderImage(AjaxRequestTarget target, boolean fullRender) {
if(returnPage != null || returnClass != null) {
link.add(new AttributeModifier("title", new ResourceModel("click_to_max")));
link.setEnabled(true);
}
link.removeAll();
Image img = null;
if(!autoDetermineChartSizeByAjax) {
img = createImage("content", getImageData());
}else{
img = createImage("content", getImageData(selectedWidth, selectedHeight));
}
img.add(AttributeModifier.replace("style", "display: none; margin: 0 auto;"));
link.add(img);
setState((byte) 1);
if(fullRender) {
if(target != null) {
target.add(link);
target.appendJavaScript("jQuery('#"+img.getMarkupId()+"').fadeIn();");
}
setState((byte) 2);
}
return img;
}
示例4: FieldInstanceImageField
import org.apache.wicket.markup.html.image.Image; //导入依赖的package包/类
public FieldInstanceImageField(String id, FieldValueModel _fieldValueModel, boolean readonly) {
super(id);
this.fieldValueModel = _fieldValueModel;
image = new Image("image");
image.add(new AttributeModifier("src", true, new AbstractReadOnlyModel<String>() {
@Override
public final String getObject() {
TopicMap topicMap = fieldValueModel.getFieldInstanceModel().getFieldInstance().getInstance().getTopicMap();
Object o = fieldValueModel.getFieldValue();
return getRequest().getRelativePathPrefixToContextRoot() + "occurrenceImages?topicMapId=" + topicMap.getId() +
"&occurrenceId=" + ((o instanceof OccurrenceIF ? ((OccurrenceIF)o).getObjectId(): "unknown"));
}
}));
upload = new UploadPanel("upload", this);
add(image);
add(upload);
if (fieldValueModel.isExistingValue()) {
upload.setVisible(false);
} else {
image.setVisible(false);
if (readonly)
upload.setVisible(false);
}
}
示例5: populateItem
import org.apache.wicket.markup.html.image.Image; //导入依赖的package包/类
@Override
public void populateItem(Item<LdapUser> item, Check<LdapUser> check) {
LdapUser user = item.getModelObject();
item.add(new Label("username", new PropertyModel(user, "userName")));
item.add(new ExternalLink("mail", "mailto:" + user.getMail()).add(new Label("mailText", new PropertyModel(user, "mail"))));
item.add(new Label("firstName", new PropertyModel(user, "firstName")));
item.add(new Label("lastName", new PropertyModel(user, "lastName")));
item.add(new Image("photo", user.hasProfilePicture() ? user.getProfilePictureImage() : anonymousPicture));
if (isSelectionEnabled()) {
if (userService.ldapBasedUserExists(user)) {
check.setVisible(false);
item.add(new AttributeAppender("class", Model.of("warning")));
item.add(new AttributeAppender("title", new StringResourceModel("table.users.warning.exists", this, null)));
} else {
item.add(new AttributeAppender("class", Model.of("success")));
}
}
}
示例6: ImageModalPanel
import org.apache.wicket.markup.html.image.Image; //导入依赖的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);
}
示例7: newLargeLogo
import org.apache.wicket.markup.html.image.Image; //导入依赖的package包/类
public static Image newLargeLogo(String id) {
ResourceReference imageResourceReference = new ResourceReference("logoLarge_" + System.currentTimeMillis()) {
@Override
protected Resource newResource() {
SearchInterfaceConfig searchInterfaceConfig = ConstellioSpringUtils
.getSearchInterfaceConfigServices().get();
Resource imageResource;
byte[] logoBytes = searchInterfaceConfig.getLogoLargeContent();
// Convert resource path to absolute path relative to base package
if (logoBytes != null) {
imageResource = new ByteArrayResource("image", logoBytes);
} else {
imageResource = PackageResource.get(BaseConstellioPage.class, "images/logo_constellio.gif");
}
return imageResource;
}
};
Image image = new NonCachingImage(id, imageResourceReference);
image.setVisible(!ConstellioSession.get().isPortletMode());
return image;
}
示例8: newSmallLogo
import org.apache.wicket.markup.html.image.Image; //导入依赖的package包/类
public static Image newSmallLogo(String id) {
ResourceReference imageResourceReference = new ResourceReference("logoSmall_" + System.currentTimeMillis()) {
@Override
protected Resource newResource() {
SearchInterfaceConfig searchInterfaceConfig = ConstellioSpringUtils
.getSearchInterfaceConfigServices().get();
Resource imageResource;
byte[] logoBytes = searchInterfaceConfig.getLogoSmallContent();
// Convert resource path to absolute path relative to base package
if (logoBytes != null) {
imageResource = new ByteArrayResource("image", logoBytes);
} else {
imageResource = PackageResource.get(BaseConstellioPage.class, "images/logo_petit.png");
}
return imageResource;
}
};
Image image = new NonCachingImage(id, imageResourceReference);
image.setVisible(!ConstellioSession.get().isPortletMode());
return image;
}
示例9: onInitialize
import org.apache.wicket.markup.html.image.Image; //导入依赖的package包/类
@Override
protected void onInitialize() {
super.onInitialize();
add(new Image("img", new RawBlobResourceReference(),
RawBlobResource.paramsOf(context.getProject(), context.getBlobIdent())));
}
示例10: getLoadingComponent
import org.apache.wicket.markup.html.image.Image; //导入依赖的package包/类
protected Component getLoadingComponent(final String markupId) {
Image image = new Image(markupId, PRELOADER);
image.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return isLoadingVisible();
}
});
return image;
}
示例11: CaptchaPanel
import org.apache.wicket.markup.html.image.Image; //导入依赖的package包/类
/**
* Constructor.
*
* @param id
* The component id
*/
public CaptchaPanel(String id) {
super(id);
FeedbackPanel feedback = new FeedbackPanel("feedback",
new ContainerFeedbackMessageFilter(CaptchaPanel.this));
add(feedback);
captchaImageResource = createCaptchImageResource();
final Image captchaImage = new Image("image", captchaImageResource);
captchaImage.setOutputMarkupId(true);
add(captchaImage);
AjaxLink<Void> changeCaptchaLink = new AjaxLink<Void>("changeLink") {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
captchaImageResource.invalidate();
target.add(captchaImage);
}
};
add(changeCaptchaLink);
add(new RequiredTextField<String>("text",
new PropertyModel<String>(CaptchaPanel.this, "captchaText"), String.class) {
private static final long serialVersionUID = 1L;
@Override
protected final void onComponentTag(final ComponentTag tag) {
super.onComponentTag(tag);
// clear the field after each render
tag.put("value", "");
}
});
}
示例12: RoomsPanel
import org.apache.wicket.markup.html.image.Image; //导入依赖的package包/类
public RoomsPanel(String id, List<Room> rooms) {
super(id);
this.rooms = rooms;
clients = new ListView<Client>("clients", clientsInRoom){
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(final ListItem<Client> item) {
Client client = item.getModelObject();
final Long userId = client.getUserId();
item.add(new Image("clientImage", new ByteArrayResource("image/jpeg") {
private static final long serialVersionUID = 1L;
@Override
protected ResourceResponse newResourceResponse(Attributes attributes) {
ResourceResponse rr = super.newResourceResponse(attributes);
rr.disableCaching();
return rr;
}
@Override
protected byte[] getData(Attributes attributes) {
String uri = null;
if (userId != null) {
uri = getBean(UserDao.class).get(userId > 0 ? userId : -userId).getPictureuri();
}
File img = OmFileHelper.getUserProfilePicture(userId, uri);
try (InputStream is = new FileInputStream(img)) {
return IOUtils.toByteArray(is);
} catch (Exception e) {
//no-op
}
return null;
}
}));
item.add(new Label("clientLogin", client.getUser().getLogin()));
item.add(new Label("from", client.getConnectedSince()));
}
};
}
示例13: refresh
import org.apache.wicket.markup.html.image.Image; //导入依赖的package包/类
public Image refresh(IPartialPageRequestHandler handler) {
captchaImageResource.invalidate();
captchaText.setModelObject("");
if (handler != null) {
handler.add(captchaText, captcha);
}
return captcha;
}
示例14: getCaptcha
import org.apache.wicket.markup.html.image.Image; //导入依赖的package包/类
private String getCaptcha(String path) throws ReflectiveOperationException, SecurityException {
// hacks with reflection
Image captchaImg = (Image)tester.getComponentFromLastRenderedPage(path);
Method m1 = Image.class.getDeclaredMethod("getImageResource");
m1.setAccessible(true);
CaptchaImageResource captcha = (CaptchaImageResource)m1.invoke(captchaImg);
Method m2 = CaptchaImageResource.class.getDeclaredMethod("getImageData", Attributes.class);
m2.setAccessible(true);
m2.invoke(captcha, (Attributes)null);
return captcha.getChallengeId();
}
示例15: onBeforeRender
import org.apache.wicket.markup.html.image.Image; //导入依赖的package包/类
@Override
protected void onBeforeRender()
{
// Defer adding the image until rendering because we need to access the properties from
// the embedding component/page
if (!hasBeenRendered()) {
ResourceReference _imageRes = imageRes;
if (_imageRes == null) {
_imageRes = new UrlResourceReference(Url.parse(getString("icon")))
.setContextRelative(true);
}
Image image = new Image("image", _imageRes);
try {
// The getString method throws an MissingResourceException if the property is
// not available. In this case, we simply do not set a tooltip
getString("tooltip");
image.add(new AttributeModifier("title",
new StringResourceModel("tooltip", ActionBarLink.this)));
}
catch (MissingResourceException e) {
// Nothing to do
}
link.add(image);
}
super.onBeforeRender();
}