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<Void> parentSelect = new IndicatingAjaxLink<Void>("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<Void> parentReset = new IndicatingAjaxLink<Void>("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<Void> userOwnerSelect = new IndicatingAjaxLink<Void>("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<Void> userOwnerReset = new IndicatingAjaxLink<Void>("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<Void> roleOwnerSelect = new IndicatingAjaxLink<Void>("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<Void> roleOwnerReset = new IndicatingAjaxLink<Void>("roleOwnerReset") {