private void updateClearLink(InputFieldVisibility visibility) {
    final MarkupContainer formComponent = (MarkupContainer) getComponentForRegular();
    formComponent.setOutputMarkupId(true); // enable ajax link

    final AjaxLink<Void> ajaxLink =
        new AjaxLink<Void>(ID_SCALAR_IF_REGULAR_CLEAR) {
          private static final long serialVersionUID = 1L;

          @Override
          public void onClick(AjaxRequestTarget target) {
            setEnabled(false);
            ScalarModel model = IsisBlobOrClobPanelAbstract.this.getModel();
            model.setObject(null);
            target.add(formComponent);
          }
        };
    ajaxLink.setOutputMarkupId(true);
    formComponent.addOrReplace(ajaxLink);

    final T blob = getBlob(getModel());
    formComponent
        .get(ID_SCALAR_IF_REGULAR_CLEAR)
        .setVisible(blob != null && visibility == InputFieldVisibility.VISIBLE);
  }
  public AjaxPagingPanel(String id, final SearchCriteria criteria) {
    super(id);

    globalContainer = new WebMarkupContainer("globalContainer");
    add(globalContainer.setOutputMarkupId(true));

    next =
        new AjaxLink("next") {
          @Override
          public void onClick(AjaxRequestTarget art) {
            criteria.next();
            refreshPaging(art, criteria);
          }

          @Override
          public boolean isEnabled() {
            return !criteria.isLastPage();
          }
        };
    globalContainer.add(next.setOutputMarkupId(true));

    prev =
        new AjaxLink("prev") {
          @Override
          public void onClick(AjaxRequestTarget art) {
            criteria.prev();
            refreshPaging(art, criteria);
          }

          @Override
          public boolean isEnabled() {
            return !criteria.isFirstPage();
          }
        };
    globalContainer.add(prev.setOutputMarkupId(true));

    snext =
        new AjaxLink("snext") {
          @Override
          public void onClick(AjaxRequestTarget art) {
            criteria.snext();
            refreshPaging(art, criteria);
          }

          @Override
          public boolean isEnabled() {
            return !criteria.isLastPage();
          }
        };
    globalContainer.add(snext.setOutputMarkupId(true));

    sprev =
        new AjaxLink("sprev") {
          @Override
          public void onClick(AjaxRequestTarget art) {
            criteria.sprev();
            refreshPaging(art, criteria);
          }

          @Override
          public boolean isEnabled() {
            return !criteria.isFirstPage();
          }
        };
    globalContainer.add(sprev.setOutputMarkupId(true));

    numbers =
        new ListView("numbers", criteria.getNumbers()) {

          @Override
          protected void populateItem(ListItem li) {
            final long pageNum = (Long) li.getModelObject();
            final Label number = new Label("number", pageNum + "");
            final AjaxLink numberLink =
                new AjaxLink("numberLink") {
                  @Override
                  public void onClick(AjaxRequestTarget art) {
                    criteria.toPage(pageNum);
                    refreshPaging(art, criteria);
                  }
                };
            if (pageNum != criteria.getCurrent()) {
              numberLink.setEnabled(true);
              li.add(AttributeModifier.remove("class"));
            } else {
              numberLink.setEnabled(false);
              li.add(AttributeModifier.append("class", "active"));
            }
            numberLink.add(number);
            li.add(numberLink);
          }
        };
    globalContainer.add(numbers.setOutputMarkupId(true));
  }