Search in sources :

Example 1 with PropertyBoxProducer

use of com.gempukku.libgdx.graph.ui.graph.property.PropertyBoxProducer 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;
}
Also used : UIGraphConfiguration(com.gempukku.libgdx.graph.ui.UIGraphConfiguration) PropertyBox(com.gempukku.libgdx.graph.ui.graph.property.PropertyBox) Actor(com.badlogic.gdx.scenes.scene2d.Actor) PropertyBoxProducer(com.gempukku.libgdx.graph.ui.graph.property.PropertyBoxProducer) ChangeListener(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener)

Example 2 with PropertyBoxProducer

use of com.gempukku.libgdx.graph.ui.graph.property.PropertyBoxProducer in project gdx-graph by MarcinSc.

the class UIGraphLoaderCallback method addPipelineProperty.

@Override
public void addPipelineProperty(String type, String name, PropertyLocation location, JsonValue data) {
    PropertyBoxProducer producer = findPropertyProducerByType(type);
    if (producer == null)
        throw new IllegalArgumentException("Unable to find property producer for type: " + type);
    PropertyBox propertyBox = producer.createPropertyBox(skin, name, location, data, propertyLocations);
    graphDesignTab.addPropertyBox(type, propertyBox);
}
Also used : PropertyBox(com.gempukku.libgdx.graph.ui.graph.property.PropertyBox) PropertyBoxProducer(com.gempukku.libgdx.graph.ui.graph.property.PropertyBoxProducer)

Aggregations

PropertyBox (com.gempukku.libgdx.graph.ui.graph.property.PropertyBox)2 PropertyBoxProducer (com.gempukku.libgdx.graph.ui.graph.property.PropertyBoxProducer)2 Actor (com.badlogic.gdx.scenes.scene2d.Actor)1 ChangeListener (com.badlogic.gdx.scenes.scene2d.utils.ChangeListener)1 UIGraphConfiguration (com.gempukku.libgdx.graph.ui.UIGraphConfiguration)1