use of com.kotcrab.vis.ui.widget.PopupMenu in project HyperLap2D by rednblackgames.
the class NodeEditorDialog method createGraphPopupMenu.
private H2DPopupMenu createGraphPopupMenu(final float popupX, final float popupY) {
H2DPopupMenu popupMenu = new H2DPopupMenu();
for (final GraphBoxProducer<ActionFieldType> producer : graphBoxProducers) {
if (producer.isUnique())
continue;
String menuLocation = producer.getMenuLocation();
if (menuLocation != null) {
String[] menuSplit = menuLocation.split("/");
PopupMenu targetMenu = findOrCreatePopupMenu(popupMenu, menuSplit, 0);
final String title = producer.getName();
MenuItem valueMenuItem = new MenuItem(title);
valueMenuItem.addListener(new ClickListener(Input.Buttons.LEFT) {
@Override
public void clicked(InputEvent event, float x, float y) {
String id = UUID.randomUUID().toString().replace("-", "");
GraphBox<ActionFieldType> graphBox = producer.createDefault(skin, id);
graphContainer.addGraphBox(graphBox, title, true, popupX, popupY);
}
});
targetMenu.addItem(valueMenuItem);
}
}
return popupMenu;
}
Aggregations