org.apache.wicket.markup.html.image.Image.add()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(9.8k)|赞(0)|评价(0)|浏览(114)

本文整理了Java中org.apache.wicket.markup.html.image.Image.add()方法的一些代码示例,展示了Image.add()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Image.add()方法的具体详情如下:
包路径:org.apache.wicket.markup.html.image.Image
类名称:Image
方法名:add

Image.add介绍

[英]Adds random noise to the url every request to prevent the browser from caching the image.
[中]在每个请求的url中添加随机干扰,以防止浏览器缓存图像。

代码示例

代码示例来源:origin: stackoverflow.com

Image img = new Image("id", yourResource);
img.add(new AjaxEventBehavior("onclick") {
  @Override
  protected void onEvent(AjaxRequestTarget target) {
    // Your click magic
  }
});
add(img);

代码示例来源:origin: org.geoserver.web/gs-web-wms

public LegendGraphicAjaxUpdater(
    final String wmsURL, final Image image, final IModel<StyleInfo> styleInfoModel) {
  this.wmsURL = wmsURL;
  this.image = image;
  this.styleInfoModel = styleInfoModel;
  this.urlModel = new Model<String>(wmsURL);
  this.image.add(new AttributeModifier("src", urlModel));
  updateStyleImage(null);
}

代码示例来源:origin: org.geoserver.web/web-wms

public void updateStyleImage(AjaxRequestTarget target) {
  String url = wmsURL
      + "REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=20&HEIGHT=20&STRICT=false&style=";
  StyleInfo styleInfo = (StyleInfo) styleInfoModel.getObject();
  if (styleInfo != null) {
    String style = styleInfo.getName();
    url += style;
    image.add(new AttributeModifier("src", new Model(url)));
    if (target != null) {
      target.addComponent(image);
    }
  }
}

代码示例来源:origin: org.wicketstuff/browserid

protected Component createSignInButton(String componentId)
{
  Image image = new Image(componentId, getImage(style));
  image.add(AttributeModifier.replace("alt", "Sign In"));
  return image;
}

代码示例来源:origin: org.geoserver.web/gs-web-core

/**
   * Constructs an Icon from a model for the resource reference and a resource model for the
   * "title" attribute to apply to the rendered "&lt;img>" tag.
   */
  public Icon(String id, IModel<?> model, IModel<String> title) {
    super(id);
    add(new Image("img", model).add(new AttributeModifier("title", title)));
  }
}

代码示例来源:origin: org.geoserver.web/web-core

/**
 * Constructs an Icon from a model for the resource reference and a resource model for the
 * "title" attribute to apply to the rendered "&lt;img>" tag. 
 */
public Icon(String id, IModel model, IModel title) {
  super(id);
  add(new Image("img", model).add(new AttributeModifier("title", true, title)));
}

代码示例来源:origin: de.agilecoders.wicket/bootstrap

/**
 * sets an image in the brand button
 *
 * @param imageResourceReference required
 * @param imageAltAttrModel      optional, but should be provided
 * @return
 */
public Navbar setBrandImage(final ResourceReference imageResourceReference, final IModel<String> imageAltAttrModel) {
  brandImage.setImageResourceReference(imageResourceReference);
  if (!Models.isNullOrEmpty(imageAltAttrModel)) {
    brandImage.add(new AttributeModifier("alt", imageAltAttrModel));
  }
  return this;
}

代码示例来源:origin: org.geoserver.web/web-core

Component removeLink(String id, IModel itemModel) {
  final LayerGroupEntry entry = (LayerGroupEntry) itemModel.getObject();
  ImageAjaxLink link = new ImageAjaxLink( id, new ResourceReference( getClass(), "../../img/icons/silk/delete.png") ) {
    @Override
    protected void onClick(AjaxRequestTarget target) {
      
      items.remove( entry );
      target.addComponent( layerTable );
    }
  };
  link.getImage().add(new AttributeModifier("alt", true, new ParamResourceModel("AbstractLayerGroupPage.th.remove", link)));
  return link;
}

代码示例来源:origin: com.googlecode/wicket-slides

protected void populate(ListItem item) {
  item.add(new Image("image").add(new AttributeModifier("src", true, item
      .getModel())));
  item.add(new Image("thumb").add(new AttributeModifier("src", true, item
      .getModel())));
  item.add(new Label("title", "TITLE"));
  item.add(new Label("description", "description"));
}

代码示例来源:origin: de.agilecoders.wicket/wicket-bootstrap-core

/**
 * sets an image in the brand button
 *
 * @param imageResourceReference required
 * @param imageAltAttrModel      optional, but should be provided
 * @return this instance for chaining
 */
public Navbar setBrandImage(final ResourceReference imageResourceReference, final IModel<String> imageAltAttrModel) {
  Image brandImage = (Image) brandNameLink.get("brandImage");
  brandImage.setImageResourceReference(imageResourceReference);
  if (!Models.isNullOrEmpty(imageAltAttrModel)) {
    brandImage.add(new AttributeModifier("alt", imageAltAttrModel));
  }
  return this;
}

代码示例来源:origin: org.geoserver.web/gs-web-core

Component removeLink(String id, IModel<LayerGroupEntry> itemModel) {
  final LayerGroupEntry entry = itemModel.getObject();
  ImageAjaxLink<Object> link =
      new ImageAjaxLink<Object>(
          id,
          new PackageResourceReference(
              getClass(), "../../img/icons/silk/delete.png")) {
        private static final long serialVersionUID = 4050942811476326745L;
        @Override
        protected void onClick(AjaxRequestTarget target) {
          items.remove(entry);
          target.add(layerTable);
        }
      };
  link.getImage()
      .add(
          new AttributeModifier(
              "alt",
              new ParamResourceModel("LayerGroupEditPage.th.remove", link)));
  return link;
}

代码示例来源:origin: org.onehippo.cms7/hippo-cms-translation-frontend

@Override
  protected void populateItem(Item<HippoLocale> item) {
    HippoLocale itemLocale = item.getModelObject();
    Image img = new CachingImage("img", itemLocale.getIcon(IconSize.M, LocaleState.EXISTS));
    if (itemLocale.getName().equals(locale)) {
      img.add(new AttributeAppender("class", Model.of("hippo-translation-current"), " "));
    }
    item.add(img);
  }
});

代码示例来源:origin: org.wicketstuff/wicketstuff-openlayers

public ZoomControl(String id, IOpenLayersMap map, ResourceReference zoomInResource,
  ResourceReference zoomOutResource)
{
  super(id);
  Image zoomIn = new Image("zoomIn", zoomInResource);
  zoomIn.add(new AttributeAppender("onClick", Model.of(map.getJSinvokeNoLineEnd("zoomIn()")),
    ";"));
  add(zoomIn);
  Image zoomOut = new Image("zoomOut", zoomOutResource);
  zoomOut.add(new AttributeAppender("onClick",
    Model.of(map.getJSinvokeNoLineEnd("zoomOut()")), ";"));
  add(zoomOut);
}

代码示例来源:origin: org.jabylon/rest.ui

public UserImagePanel(String id, IModel<User> model, boolean large) {
  super(id,model);
  Label name = new Label("name", getUsername(model));
  add(name);
  if(large) {
    name.add(new AttributeAppender("style", "font-size: large;"));
    size = LARGE_SIZE;
  }
  Image image = new Image("image", getImageUrl(model));
  if(large)
    image.add(new AttributeAppender("class","img-polaroid"));
  add(image);
}

代码示例来源:origin: org.geoserver.web/web-core

@Override
  protected void populateItem(ListItem item) {
    final OtherStoreDescription store = (OtherStoreDescription) item.getModelObject();
    SubmitLink link;
    link = new SubmitLink("resourcelink") {
      @Override
      public void onSubmit() {
        setResponsePage(store.configurationPage);
      }
    };
    link.setEnabled(thereAreWorkspaces);
    link.add(new Label("resourcelabel", new ParamResourceModel("other." + store.key, NewDataPage.this)));
    item.add(link);
    item.add(new Label("resourceDescription", new ParamResourceModel("other." + store.key + ".description", NewDataPage.this)));
    Image icon = new Image("storeIcon", store.icon);
    // TODO: icons could provide a description too to be used in alt=...
    icon.add(new AttributeModifier("alt", true, new Model("")));
    item.add(icon);
  }
};

代码示例来源:origin: org.geoserver.community/importer-web

@Override
  protected void populateItem(ListItem item)
  {
    Store store = (Store) item.getModelObject();
    BookmarkablePageLink link = new BookmarkablePageLink("storeLink", store.getDestinationPage());
    link.add(new Label("storeName", store.getStoreName(StoreChooserPage.this)));
    link.setEnabled(thereAreWorkspaces);
    item.add(link);
    item.add(new Label("storeDescription", store.getStoreDescription(StoreChooserPage.this)));
    Image icon = new Image("storeIcon", store.getStoreIcon());
    icon.add(new AttributeModifier("alt", true, store.getStoreDescription(StoreChooserPage.this)));
    item.add(icon);
  }
};

代码示例来源:origin: org.apache.wicket/wicket-core

/**
 * Constructs a client-side image map which is "attached" to the given {@link Image} component.
 * 
 * @param id
 *            the component id
 * @param image
 *            the image component
 */
public ClientSideImageMap(String id, Image image)
{
  super(id);
  setOutputMarkupId(true);
  add(AttributeModifier.replace("name", new PropertyModel<String>(this, "markupId")));
  image.add(AttributeModifier.replace("usemap", new UsemapModel()));
  areas = new RepeatingView("area");
  add(areas);
}

代码示例来源:origin: apache/wicket

/**
 * Constructs a client-side image map which is "attached" to the given {@link Image} component.
 * 
 * @param id
 *            the component id
 * @param image
 *            the image component
 */
public ClientSideImageMap(String id, Image image)
{
  super(id);
  setOutputMarkupId(true);
  add(AttributeModifier.replace("name", new PropertyModel<String>(this, "markupId")));
  image.add(AttributeModifier.replace("usemap", new UsemapModel()));
  areas = new RepeatingView("area");
  add(areas);
}

代码示例来源:origin: org.openengsb.ui/org.openengsb.ui.common

private void addTooltip(AttributeDefinition attribute) {
  Image tooltip = new Image("tooltip", new ResourceReference(AbstractField.class, "balloon.png"));
  if (attribute.hasDescription()) {
    tooltip.add(new AttributeModifier("title", true, new LocalizableStringModel(this, attribute
      .getDescription())));
  } else {
    tooltip.setVisible(false);
  }
  add(tooltip);
}

代码示例来源:origin: org.ops4j.pax.wicket/pax-wicket-service

/**
 * Constructs a client-side image map which is "attached" to the given {@link Image} component.
 * 
 * @param id
 *            the component id
 * @param image
 *            the image component
 */
public ClientSideImageMap(String id, Image image)
{
  super(id);
  setOutputMarkupId(true);
  add(new AttributeModifier("name", true, new PropertyModel<String>(this, "markupId")));
  image.add(new AttributeModifier("usemap", true, new UsemapModel()));
  areas = new RepeatingView("area");
  add(areas);
}

相关文章