All,

I have a simple application where I can change the size, position, and color
of a div within a page.  When I click on the div I want some functionality
to be performed, however the onclick event is never being returned to the
server, and is instead intercepted and rejected by the javascript, I get the
error
"Ajax GET stopped because of precondition check,
url:;jsessionid=e80700c56cdf00f163ab8b7adb38?wicket:interface=:0:superDiv::IBehaviorListener:0:"

HomePage.java -
public class HomePage extends BasePage
{

    CompoundPropertyModel<RectInfo> rectInfoModel = new
CompoundPropertyModel<RectInfo>(new RectInfo(100, 100, 400, 400, "blue"));
    WebMarkupContainer superDiv = new SuperDiv("superDiv", rectInfoModel);

    public HomePage()    {
        ... form setup ...
        superDiv.add(new AjaxEventBehavior("onmousedown")
        {

            @Override
            protected void onEvent(AjaxRequestTarget target)
            {
                System.out.println("dicks");
            }
        });
        add(superDiv.setOutputMarkupId(true));

    }

    private class SuperDiv extends WebMarkupContainer
    {

        IModel<RectInfo> rectInfoModel;

        public SuperDiv(String id, IModel<RectInfo> rectInfoModel)
        {
            super(id);
            this.rectInfoModel = rectInfoModel;
        }

        @Override
        protected void onComponentTag(ComponentTag tag)
        {
            tag.put("style",
                    "position: static;" +
                    "top: " + getModelObject().getTop() + ";" +
                    "left: " + getModelObject().getLeft() + ";" +
                    "height: " + getModelObject().getHeight() + ";" +
                    "width: " + getModelObject().getWidth() + ";" +
                    "background-color: " + getModelObject().getColor() +
";");
        }

        public RectInfo getModelObject()
        {
            return rectInfoModel.getObject();
        }

        public void setModelObject(RectInfo rectInfo)
        {
            rectInfoModel.setObject(rectInfo);
        }
    }

The markup is simple, I can post that if requested, but it's just a div with
a wicket:id tag.

Thanks in advance!

Reply via email to