/** * Sets the actions that will be turned into ActionButtons at the bottom of the panel. Any action * that is clicked will also call the OptionPanel.close() method which by default removes the * panel from its parent node. */ public void setOptions(Action... options) { if (this.options == options) { return; } if (this.options != null) { // Need to clear out any old button listeners for (Node n : buttons.getLayout().getChildren()) { if (!(n instanceof Button)) { continue; } ((Button) n).removeClickCommands(listener); } } this.options = options; buttons.clearChildren(); if (options.length == 0) { options = new Action[] {new EmptyAction("Ok")}; } for (Action a : options) { ActionButton button = new ActionButton(a, getElementId().child("button"), getStyle()); button.addClickCommands(listener); buttons.addChild(button); } }
@Override protected void presentationPropertyChanded(PropertyChangeEvent e) { super.presentationPropertyChanded(e); if (Presentation.PROP_TEXT.equals(e.getPropertyName())) { revalidate(); // recalc preferred size & repaint instantly } }