};
link1.add(new AttributeAppender("class", true, new Model<String>("link1"), " "));
Label label1 = new Label(MenuItem.CAPTION_ID, "One");
label1.setVisible(false);
result.add(new MenuItem(link1, label1));
AjaxLink<Object> link2 = new AjaxLink<Object>(MenuItem.LINK_ID) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
}
@Override
protected IAjaxCallDecorator getAjaxCallDecorator() {
return new AjaxCallDecorator() {
private static final long serialVersionUID = 1L;
@Override
public CharSequence decorateOnSuccessScript(CharSequence script) {
return "alert('Success');";
}
@Override
public CharSequence decorateOnFailureScript(CharSequence script) {
return "alert('Failure');";
}
@Override
public CharSequence decorateScript(CharSequence script) {
return "alert('Before ajax call');" + script;
}
};
}
};
link2.add(new AttributeAppender("class", true, new Model<String>("link2"), " "));
Label label2 = new Label(MenuItem.CAPTION_ID, "One");
label2.setVisible(false);
result.add(new MenuItem(link2, label2));
Link<Object> link3 = new Link<Object>(MenuItem.LINK_ID) {
private static final long serialVersionUID = 1L;
@Override
public void onClick() {
}
};
link3.add(new AttributeAppender("class", true, new Model<String>("link3"), " "));
Label label3 = new Label(MenuItem.CAPTION_ID, "One");
label3.setVisible(false);
result.add(new MenuItem(link3, label3));
Link<Object> link4 = new Link<Object>(MenuItem.LINK_ID) {
private static final long serialVersionUID = 1L;
@Override
public void onClick() {
}
};
link4.add(new AttributeAppender("class", true, new Model<String>("link4"), " "));
Label label4 = new Label(MenuItem.CAPTION_ID, "One");
label4.setVisible(false);
result.add(new MenuItem(link4, label4));
return result;
}