SplitPaneLayoutData splitPaneLayoutData = new SplitPaneLayoutData();
splitPaneLayoutData.setInsets(new Insets(10));
setLayoutData(splitPaneLayoutData);
Button delayButton = new Button("Test 3 second delay");
delayButton.setStyleName("Default");
delayButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
Thread.sleep(3000);
} catch (InterruptedException ex) {
}
}
});
add(delayButton);
final Button blockedButton = new Button("This button has been clicked 0 times");
blockedButton.setStyleName("Default");
blockedButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
blockedButton.setText("This button has been clicked " + ++clickCount + " times");
}
});
add(blockedButton);
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"));
}