@Override
public void install(Component component) {
super.install(component);
Alert alert = (Alert)component;
alert.setPreferredWidth(320);
alert.setMinimumWidth(160);
alert.getAlertListeners().add(this);
// Load the alert content
BXMLSerializer bxmlSerializer = new BXMLSerializer();
Component content;
try {
content = (Component)bxmlSerializer.readObject(TerraAlertSkin.class,
"terra_alert_skin.bxml");
} catch(Exception exception) {
throw new RuntimeException(exception);
}
alert.setContent(content);
typeImageView = (ImageView)bxmlSerializer.getNamespace().get("typeImageView");
messageLabel = (Label)bxmlSerializer.getNamespace().get("messageLabel");
messageBoxPane = (BoxPane)bxmlSerializer.getNamespace().get("messageBoxPane");
optionButtonBoxPane = (BoxPane)bxmlSerializer.getNamespace().get("optionButtonBoxPane");
for (Object option : alert.getOptions()) {
PushButton optionButton = new PushButton(option);
optionButton.setStyleName(TerraAlertSkin.class.getPackage().getName()
+ "." + TerraTheme.COMMAND_BUTTON_STYLE);
optionButton.getButtonPressListeners().add(optionButtonPressListener);