Search in sources :

Example 1 with EnumParam

use of jcog.math.EnumParam in project narchy by automenta.

the class AutoSurface method newSwitch.

private ButtonSet newSwitch(EnumParam x) {
    ToggleButton[] b = ((EnumSet<?>) EnumSet.allOf(x.klass)).stream().map(e -> {
        CheckBox tb = new CheckBox(e.name());
        tb.on((c, enabled) -> {
            if (enabled)
                x.set(e);
        });
        return tb;
    }).toArray(ToggleButton[]::new);
    ButtonSet s = new ButtonSet(ButtonSet.Mode.One, b);
    return s;
}
Also used : java.util(java.util) Surface(spacegraph.space2d.Surface) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) Widget(spacegraph.space2d.widget.windo.Widget) IntSlider(spacegraph.space2d.widget.slider.IntSlider) ButtonSet(spacegraph.space2d.widget.tab.ButtonSet) Gridding(spacegraph.space2d.container.Gridding) ToggleButton(spacegraph.space2d.widget.button.ToggleButton) LabeledPane(spacegraph.space2d.widget.text.LabeledPane) FloatSlider(spacegraph.space2d.widget.slider.FloatSlider) PushButton(spacegraph.space2d.widget.button.PushButton) Ons(jcog.event.Ons) FasterList(jcog.list.FasterList) EnumParam(jcog.math.EnumParam) FloatRange(jcog.math.FloatRange) Service(jcog.Service) IntRange(jcog.math.IntRange) Field(java.lang.reflect.Field) Sets(com.google.common.collect.Sets) CheckBox(spacegraph.space2d.widget.button.CheckBox) Nullable(org.jetbrains.annotations.Nullable) SurfaceBase(spacegraph.space2d.SurfaceBase) SpaceGraph(spacegraph.SpaceGraph) Modifier(java.lang.reflect.Modifier) Services(jcog.Services) ToggleButton(spacegraph.space2d.widget.button.ToggleButton) ButtonSet(spacegraph.space2d.widget.tab.ButtonSet) CheckBox(spacegraph.space2d.widget.button.CheckBox)

Aggregations

Sets (com.google.common.collect.Sets)1 Field (java.lang.reflect.Field)1 Modifier (java.lang.reflect.Modifier)1 java.util (java.util)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 Service (jcog.Service)1 Services (jcog.Services)1 Ons (jcog.event.Ons)1 FasterList (jcog.list.FasterList)1 EnumParam (jcog.math.EnumParam)1 FloatRange (jcog.math.FloatRange)1 IntRange (jcog.math.IntRange)1 Nullable (org.jetbrains.annotations.Nullable)1 SpaceGraph (spacegraph.SpaceGraph)1 Surface (spacegraph.space2d.Surface)1 SurfaceBase (spacegraph.space2d.SurfaceBase)1 Gridding (spacegraph.space2d.container.Gridding)1 CheckBox (spacegraph.space2d.widget.button.CheckBox)1 PushButton (spacegraph.space2d.widget.button.PushButton)1 ToggleButton (spacegraph.space2d.widget.button.ToggleButton)1