Package org.apache.wicket.model

Examples of org.apache.wicket.model.IModel


  }

  /* gets replacement with null check. */
  private Object getReplacementOrNull(final Component component)
  {
    IModel model = replaceModel;
    if (model instanceof IComponentAssignedModel)
    {
      model = ((IComponentAssignedModel)model).wrapOnAssignment(component);
    }
    return (model != null) ? model.getObject() : null;
  }
View Full Code Here


        Object next = newModels.next();
        if (next != null && ! (next instanceof IModel))
        {
          throw new WicketRuntimeException("Expecting an instance of " + IModel.class.getName() + ", got " + next.getClass().getName());
        }
        final IModel model = (IModel)next;

        Item item = factory.newItem(index, model);
        index++;

        return item;
View Full Code Here

   *
   * @return The backing model object
   */
  public final Object getModelObject()
  {
    final IModel model = getModel();
    if (model != null)
    {
      // Get model value for this component.
      return model.getObject();
    }
    else
    {
      return null;
    }
View Full Code Here

   *         component's model.
   */
  public final boolean sameInnermostModel(final IModel model)
  {
    // Get the two models
    IModel thisModel = getModel();
    IModel thatModel = model;

    // If both models are non-null they could be the same
    if (thisModel != null && thatModel != null)
    {
      return getInnermostModel(thisModel) == getInnermostModel(thatModel);
View Full Code Here

    if (this.model != null)
    {
      this.model.detach();
    }

    IModel prevModel = this.model;
    if (prevModel instanceof IWrapModel)
    {
      prevModel = ((IWrapModel)prevModel).getWrappedModel();
    }
View Full Code Here

   *            The object to set
   * @return This
   */
  public final Component setModelObject(final Object object)
  {
    final IModel model = getModel();

    // Check whether anything can be set at all
    if (model == null)
    {
      throw new IllegalStateException(
          "Attempt to set model object on null model of component: " +
              getPageRelativePath());
    }

    // Check authorization
    if (!isActionAuthorized(ENABLE))
    {
      throw new UnauthorizedActionException(this, ENABLE);
    }

    // Check whether this will result in an actual change
    if (!getModelComparator().compare(this, object))
    {
      modelChanging();
      model.setObject(object);
      modelChanged();
    }

    return this;
  }
View Full Code Here

   *            The model
   * @return The innermost (most nested) model
   */
  protected final IModel getInnermostModel(final IModel model)
  {
    IModel nested = model;
    while (nested != null && nested instanceof IWrapModel)
    {
      final IModel next = ((IWrapModel)nested).getWrappedModel();
      if (nested == next)
      {
        throw new WicketRuntimeException("Model for " + nested + " is self-referential");
      }
      nested = next;
View Full Code Here

    {
      // Get model
      // Dont call the getModel() that could initialize many inbetween
      // completely useless models.
      // IModel model = current.getModel();
      IModel model = current.model;

      if (model instanceof IWrapModel)
      {
        model = ((IWrapModel)model).getWrappedModel();
      }
View Full Code Here

  {
    // the #getModel() call below will resolve and assign any inheritable
    // model this component can use. Set that directly to the label and
    // editor so that those components work like this enclosing panel
    // does not exist (must have that e.g. with CompoundPropertyModels)
    IModel m = getModel();

    // check that a model was found
    if (m == null)
    {
      Component parent = getParent();
View Full Code Here

   *
   * @return The model
   */
  public final IModel getModel()
  {
    IModel model = getModelImpl();
    // If model is null
    if (model == null)
    {
      // give subclass a chance to lazy-init model
      model = initModel();
View Full Code Here

TOP

Related Classes of org.apache.wicket.model.IModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.