public boolean build() { scrollPaneTable.clearChildren(); if (properties.getProxies().first() instanceof GroupEntityProxy) { return false; } boolean atLeastOneComponentAdded = false; for (Class<? extends Component> clazz : componentClasses) { if (EntityUtils.isComponentCommon(clazz, properties.getProxies()) == false) { VisTextButton button = new VisTextButton(clazz.getSimpleName(), buttonStyle); button.setFocusBorderEnabled(false); scrollPaneTable.add(button).expandX().fillX().row(); button.addListener( new VisChangeListener( (event, actor) -> { listener.selected(clazz); remove(); })); atLeastOneComponentAdded = true; } } invalidateHierarchy(); return atLeastOneComponentAdded; }
@Override public boolean remove() { if (getStage() != null) { properties.removeListener(inputListener); getStage().removeListener(inputListener); } return super.remove(); }
@Override protected void setStage(Stage stage) { super.setStage(stage); if (stage != null) { properties.addListener(inputListener); stage.addListener(inputListener); } }