org.apache.wicket.model.Model类的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(136)

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

Model介绍

[英]Model is the basic implementation of an IModel. It just wraps a simple model object. The model object must be serializable, as it is stored in the session. If you have large objects to store, consider using org.apache.wicket.model.LoadableDetachableModelinstead of this class.
[中]ModelIModel的基本实现。它只是包装了一个简单的模型对象。模型对象必须是可序列化的,因为它存储在会话中。如果有大对象要存储,请考虑使用ORG。阿帕奇。小门。模型LoadableDetachableModel而不是此类。

代码示例

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

/**
 * Constructs a rating component with 5 stars, using the rating for retrieving the rating.
 * 
 * @param id
 *            the component id
 * @param rating
 *            the model to get the rating
 */
public RatingPanel(final String id, final IModel<? extends Number> rating)
{
  this(id, rating, new Model<Integer>(5), null, new Model<>(Boolean.FALSE), true);
}

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

/**
 * Constructor.
 * 
 * @param id
 *            The name of this component
 * @param href
 *            the href attribute to set
 */
public ExternalLink(final String id, final String href)
{
  this(id, Model.of(href));
}

代码示例来源:origin: de.tudarmstadt.ukp.inception.app/inception-app-ui-search

@Override
  public void onSubmit()
  {
    if (targetQuery.getObject() == null) {
      targetQuery.setObject(new String("*.*"));
    }
    searchDocuments(targetQuery.getObject());
  }
};

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

/**
 * Creates an external image
 * 
 * @param id
 *            the component id
 * @param src
 *            the source URL
 */
public ExternalImage(String id, Serializable src)
{
  this(id, Model.of(src), Model.ofList(Collections.<Serializable> emptyList()));
}

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

@Override
public IModel getModel(IModel itemModel) {
  return new Model(
      (Boolean) getPropertyValue((GeoServerUser) itemModel.getObject()));
}

代码示例来源:origin: org.opensingular/singular-server-commons

@Override
protected void onInitialize() {
  super.onInitialize();
  WebMarkupContainer ownerLink = new WebMarkupContainer("ownerLink");
  ownerLink.add(new AttributeModifier("href", new ResourceModel("footer.product.owner.addr")));
  ownerLink.add(new AttributeModifier("title", new ResourceModel("footer.product.owner.title")));
  add(new Label("version", Model.of(getVersion())));
  add(ownerLink);
}

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

public TextDialog(IModel<String> title, IModel<String> question, IModel<String> textModel) {
  super();
  this.title = title;
  add(new Label("question", question));
  TextAreaWidget textfield;
  add(textfield = new TextAreaWidget("value", textModel));
  textfield.addBehaviourOnFormComponent(
      new AttributeAppender("class", true, new Model<String>("text-dialog-textarea"), " "));
  setFocus(textfield.getFocusComponent());
}

代码示例来源:origin: micromata/projectforge

@Override
 public void populateItem(final Item<ICellPopulator<HRPlanningEntryDO>> item, final String componentId,
   final IModel<HRPlanningEntryDO> rowModel)
 {
  final String formattedPriority = priorityFormatter.getFormattedPriority(rowModel.getObject().getPriority());
  final Label label = new Label(componentId, new Model<String>(formattedPriority));
  label.setEscapeModelStrings(false);
  item.add(label);
  cellItemListener.populateItem(item, componentId, rowModel);
  cellItemListener.populateItem(item, componentId, rowModel);
 }
});

代码示例来源:origin: micromata/projectforge

@Override
 public void populateItem(final Item<ICellPopulator<AuftragDO>> item, final String componentId,
   final IModel<AuftragDO> rowModel)
 {
  item.add(new Label(componentId, NumberFormatter.format(rowModel.getObject().getPersonDays())));
  item.add(AttributeModifier.append("style", new Model<String>("text-align: right;")));
  cellItemListener.populateItem(item, componentId, rowModel);
 }
});

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

private LinkToDetailLink(String id, IModel<?> modelForLink)
{
  super(id);
  add(new Label("linkText", modelForLink));
  monitorLabel = modelForLink.getObject().toString();
  add(AttributeModifier.append("class", Model.<String> of("jamonLinkToDetailPanel")));
}

代码示例来源:origin: ro.fortsoft.wicket.dashboard/wicket-dashboard-core

@Override
  protected void onInitialize() {
    super.onInitialize();
    IModel<String> resourceModel = new StringResourceModel("deleteAsk", this, Model.of(widget.getTitle()));
    setConfirmMessage(resourceModel.getObject());
  }
};

代码示例来源:origin: org.jbehave.web/jbehave-web-runner

@SuppressWarnings("rawtypes")
public HtmlEscapingVelocityPanel(String id, IModel<? extends Map> model,
    PackageResourceStream packageResourceStream, String classAttribute) {
  super(id, model);
  this.templateResource = packageResourceStream;
  add(new AttributeModifier("class", new Model<String>(classAttribute)));
}

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

/**
 * Construct.
 *
 * @param id    the component id
 * @param model the default image url
 */
public ThumbnailBorder(String id, IModel<String> model) {
  super(id, model);
  add(title = new Label("title", Model.of("")),
    image = new Label("image").add(new AttributeModifier("url", getDefaultModel())));
}

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

/**
 * creates a new label component
 *
 * @param markupId the component id of the label
 * @return new label component
 */
protected Component newLabel(final String markupId) {
  return new Label(markupId, new Model<>(""))
      .setRenderBodyOnly(true);
}

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

public LinkCounterPage() {
    add(counterLabel = new Label("counter", Model.of(counter)));
    add(new Link<Void>("link") {
      private static final long serialVersionUID = 1L;

      @Override
      public void onClick() {
        counter++;
        counterLabel.setDefaultModelObject(counterLabel);
      }
    });
  }
}

代码示例来源:origin: micromata/projectforge

public RadioButtonLabelPanel(final String id, final IModel<T> model, final String label)
{
 super(id);
 radioButton = new Radio<T>("radioButton", model);
 add(radioButton);
 final Model<String> labelModel = new Model<String>(label);
 radioButton.setLabel(labelModel);
 // I18n key must be implemented as Model not as String because in constructor (before adding this component to parent) a warning will be
 // logged for using getString(String).
 add(new Label("label", labelModel).add(AttributeModifier.replace("for", radioButton.getMarkupId())));
 setRenderBodyOnly(true);
}

代码示例来源:origin: micromata/projectforge

@Override
 public void populateItem(final Item<ICellPopulator<HRViewUserData>> item, final String componentId,
   final IModel<HRViewUserData> rowModel)
 {
  final HRViewUserData userData = rowModel.getObject();
  addLabel(item, componentId, userData.getPlannedDaysRestSum(), userData.getActualDaysRestSum());
  item.add(AttributeModifier.append("style", new Model<String>("text-align: right;")));
  cellItemListener.populateItem(item, componentId, rowModel);
 }
});

代码示例来源:origin: micromata/projectforge

public ButtonPanel(final String id, final String label, final ButtonType... buttonTypes)
{
 super(id);
 button = new Button(BUTTON_ID, new Model<String>(label));
 button.add(new Label("title", label));
 for (final ButtonType buttonType : buttonTypes) {
  button.add(AttributeModifier.append("class", buttonType.getClassAttrValue()));
 }
 add(button);
}

代码示例来源:origin: org.opensingular/exemplos-form

@Override
protected Label buildLabel(String id, AttributeModel<String> labelModel) {
  String s = labelModel.getObject();
  s = s.replace("\n", "<br />");
  Label label = new Label(id, Model.of(s));
  label.setEscapeModelStrings(false);
  return label;
}

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

public DemoDatatable(String id)
{
  super(id);
  setOutputMarkupId(true);
  add(new AttributeModifier("class", Model.of("display")));
}

相关文章