use of com.gempukku.libgdx.graph.ui.UIGraphConfiguration in project gdx-graph by MarcinSc.
the class GraphDesignTab method createPropertyPopupMenu.
private PopupMenu createPropertyPopupMenu(float x, float y) {
PopupMenu menu = new PopupMenu();
for (UIGraphConfiguration uiGraphConfiguration : uiGraphConfigurations) {
for (Map.Entry<String, PropertyBoxProducer> propertyEntry : uiGraphConfiguration.getPropertyBoxProducers().entrySet()) {
final String name = propertyEntry.getKey();
final PropertyBoxProducer value = propertyEntry.getValue();
MenuItem valueMenuItem = new MenuItem(name);
valueMenuItem.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
PropertyBox defaultPropertyBox = value.createDefaultPropertyBox(skin, type.getPropertyLocations());
addPropertyBox(name, defaultPropertyBox);
}
});
menu.addItem(valueMenuItem);
}
}
return menu;
}
use of com.gempukku.libgdx.graph.ui.UIGraphConfiguration in project gdx-graph by MarcinSc.
the class GraphDesignTab method createGraphPopupMenu.
private PopupMenu createGraphPopupMenu(final float popupX, final float popupY) {
PopupMenu popupMenu = new PopupMenu();
for (UIGraphConfiguration uiGraphConfiguration : uiGraphConfigurations) {
boolean hasChild = false;
for (final GraphBoxProducer producer : uiGraphConfiguration.getGraphBoxProducers()) {
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 ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
String id = UUID.randomUUID().toString().replace("-", "");
GraphBox graphBox = producer.createDefault(skin, id);
graphContainer.addGraphBox(graphBox, title, true, popupX, popupY);
}
});
targetMenu.addItem(valueMenuItem);
hasChild = true;
}
}
if (hasChild)
popupMenu.addSeparator();
}
MenuItem propertyMenuItem = new MenuItem("Property");
propertyMenuItem.setDisabled(true);
popupMenu.addItem(propertyMenuItem);
if (!propertyBoxes.isEmpty()) {
PopupMenu propertyMenu = new PopupMenu();
for (final PropertyBox propertyProducer : propertyBoxes) {
final String name = propertyProducer.getName();
MenuItem valueMenuItem = new MenuItem(name);
valueMenuItem.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
String id = UUID.randomUUID().toString().replace("-", "");
GraphBox graphBox = propertyProducer.createPropertyBox(skin, id, popupX, popupY);
graphContainer.addGraphBox(graphBox, "Property", true, popupX, popupY);
}
});
propertyMenu.addItem(valueMenuItem);
}
propertyMenuItem.setSubMenu(propertyMenu);
propertyMenuItem.setDisabled(false);
}
return popupMenu;
}
Aggregations