Button setNullButton = new Button("Set ServerDelayMessage to None");
setNullButton.setStyleName("Default");
setNullButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ContainerContext containerContext
= (ContainerContext) getApplicationInstance().getContextProperty(ContainerContext.CONTEXT_PROPERTY_NAME);
containerContext.setServerDelayMessage(null);
}
});
add(setNullButton);
Button setDefaultButton = new Button("Set ServerDelayMessage to Default");
setDefaultButton.setStyleName("Default");
setDefaultButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ContainerContext containerContext
= (ContainerContext) getApplicationInstance().getContextProperty(ContainerContext.CONTEXT_PROPERTY_NAME);
containerContext.setServerDelayMessage(DefaultServerDelayMessage.INSTANCE);
}
});
add(setDefaultButton);
Button setCustomDefaultButton = new Button("Set ServerDelayMessage to Custom DefaultServerDelayMessage");
setCustomDefaultButton.setStyleName("Default");
setCustomDefaultButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ContainerContext containerContext
= (ContainerContext) getApplicationInstance().getContextProperty(ContainerContext.CONTEXT_PROPERTY_NAME);
containerContext.setServerDelayMessage(new DefaultServerDelayMessage("Well, this seems to be taking a while. "
+ "Now might be a good time to grab a snack or a frosty beverage from the kitchen."));
}
});
add(setCustomDefaultButton);
Button coolButton = new Button("Set ServerDelayMessage to CoolDelayMessage");
coolButton.setStyleName("Default");
coolButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ContainerContext containerContext
= (ContainerContext) getApplicationInstance().getContextProperty(ContainerContext.CONTEXT_PROPERTY_NAME);
containerContext.setServerDelayMessage(new CoolDelayMessage(containerContext, "PLEASE WAIT"));
}
});
add(coolButton);
}