ownerContainer = new WebMarkupContainer("ownerContainer");
ownerContainer.setOutputMarkupId(true);
this.add(ownerContainer);
final ModalWindow userOwnerSelectWin = new ModalWindow("userOwnerSelectWin");
userOwnerSelectWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
userOwnerSelectWin.setCookieName("create-userOwnerSelect-modal");
this.add(userOwnerSelectWin);
final ModalWindow roleOwnerSelectWin = new ModalWindow("roleOwnerSelectWin");
roleOwnerSelectWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
roleOwnerSelectWin.setCookieName("create-roleOwnerSelect-modal");
this.add(roleOwnerSelectWin);
final ModalWindow parentSelectWin = new ModalWindow("parentSelectWin");
parentSelectWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
parentSelectWin.setCookieName("create-parentSelect-modal");
this.add(parentSelectWin);
if (templateMode) {
parentFragment = new Fragment("parent", "parentFragment", this);
parentModel = new ParentModel(roleTO);
final AjaxTextFieldPanel parent = new AjaxTextFieldPanel("parent", "parent", parentModel);
parent.setReadOnly(true);
parent.setOutputMarkupId(true);
parentFragment.add(parent);
final IndicatingAjaxLink parentSelect = new IndicatingAjaxLink("parentSelect") {
private static final long serialVersionUID = -7978723352517770644L;
@Override
public void onClick(final AjaxRequestTarget target) {
parentSelectWin.setPageCreator(new ModalWindow.PageCreator() {
private static final long serialVersionUID = -7834632442532690940L;
@Override
public Page createPage() {
return new RoleSelectModalPage(getPage().getPageReference(), parentSelectWin,
ParentSelectPayload.class);
}
});
parentSelectWin.show(target);
}
};
parentFragment.add(parentSelect);
final IndicatingAjaxLink parentReset = new IndicatingAjaxLink("parentReset") {
private static final long serialVersionUID = -7978723352517770644L;
@Override
public void onClick(final AjaxRequestTarget target) {
parentModel.setObject(null);
target.add(parent);
}
};
parentFragment.add(parentReset);
} else {
parentFragment = new Fragment("parent", "emptyFragment", this);
}
parentFragment.setOutputMarkupId(true);
this.add(parentFragment);
final AjaxTextFieldPanel name =
new AjaxTextFieldPanel("name", "name", new PropertyModel<String>(roleTO, "name"));
final WebMarkupContainer jexlHelp = JexlHelpUtil.getJexlHelpWebContainer("jexlHelp");
this.add(jexlHelp);
final AjaxLink questionMarkJexlHelp = JexlHelpUtil.getAjaxLink(jexlHelp, "questionMarkJexlHelp");
this.add(questionMarkJexlHelp);
if (!templateMode) {
name.addRequiredLabel();
questionMarkJexlHelp.setVisible(false);
}
this.add(name);
userOwnerModel = new OwnerModel(roleTO, AttributableType.USER);
final AjaxTextFieldPanel userOwner = new AjaxTextFieldPanel("userOwner", "userOwner", userOwnerModel);
userOwner.setReadOnly(true);
userOwner.setOutputMarkupId(true);
ownerContainer.add(userOwner);
final IndicatingAjaxLink userOwnerSelect = new IndicatingAjaxLink("userOwnerSelect") {
private static final long serialVersionUID = -7978723352517770644L;
@Override
public void onClick(final AjaxRequestTarget target) {
userOwnerSelectWin.setPageCreator(new ModalWindow.PageCreator() {
private static final long serialVersionUID = -7834632442532690940L;
@Override
public Page createPage() {
return new UserOwnerSelectModalPage(getPage().getPageReference(), userOwnerSelectWin);
}
});
userOwnerSelectWin.show(target);
}
};
ownerContainer.add(userOwnerSelect);
final IndicatingAjaxLink userOwnerReset = new IndicatingAjaxLink("userOwnerReset") {
private static final long serialVersionUID = -7978723352517770644L;
@Override
public void onClick(final AjaxRequestTarget target) {
userOwnerModel.setObject(null);
target.add(userOwner);
}
};
ownerContainer.add(userOwnerReset);
roleOwnerModel = new OwnerModel(roleTO, AttributableType.ROLE);
final AjaxTextFieldPanel roleOwner = new AjaxTextFieldPanel("roleOwner", "roleOwner", roleOwnerModel);
roleOwner.setReadOnly(true);
roleOwner.setOutputMarkupId(true);
ownerContainer.add(roleOwner);
final IndicatingAjaxLink roleOwnerSelect = new IndicatingAjaxLink("roleOwnerSelect") {
private static final long serialVersionUID = -7978723352517770644L;
@Override
public void onClick(final AjaxRequestTarget target) {
parentSelectWin.setPageCreator(new ModalWindow.PageCreator() {
private static final long serialVersionUID = -7834632442532690940L;
@Override
public Page createPage() {
return new RoleSelectModalPage(getPage().getPageReference(), parentSelectWin,
RoleOwnerSelectPayload.class);
}
});
parentSelectWin.show(target);
}
};
ownerContainer.add(roleOwnerSelect);
final IndicatingAjaxLink roleOwnerReset = new IndicatingAjaxLink("roleOwnerReset") {