Search in sources :

Example 1 with HasMenuItems

use of artisynth.core.modelbase.HasMenuItems in project artisynth_core by artisynth.

the class MenuBarHandler method getApplicationMenuItems.

ArrayList<Object> getApplicationMenuItems(RootModel root) {
    ArrayList<Object> items = new ArrayList<Object>();
    boolean hasItems = false;
    hasItems |= addMenuItems(items, root);
    for (int i = 0; i < root.numComponents(); i++) {
        ModelComponent comp0 = root.get(i);
        if (comp0 instanceof HasMenuItems) {
            hasItems |= addMenuItems(items, (HasMenuItems) comp0);
        }
        if (comp0 instanceof CompositeComponent) {
            CompositeComponent ccomp = (CompositeComponent) comp0;
            for (int j = 0; j < ccomp.numComponents(); j++) {
                ModelComponent comp1 = ccomp.get(j);
                if (comp1 instanceof HasMenuItems) {
                    hasItems |= addMenuItems(items, (HasMenuItems) comp1);
                }
            }
        }
    }
    return hasItems ? items : null;
}
Also used : HasMenuItems(artisynth.core.modelbase.HasMenuItems) ModelComponent(artisynth.core.modelbase.ModelComponent) ArrayList(java.util.ArrayList) CompositeComponent(artisynth.core.modelbase.CompositeComponent)

Aggregations

CompositeComponent (artisynth.core.modelbase.CompositeComponent)1 HasMenuItems (artisynth.core.modelbase.HasMenuItems)1 ModelComponent (artisynth.core.modelbase.ModelComponent)1 ArrayList (java.util.ArrayList)1