src/main/java/de/dosmike/sponge/megamenus/impl/BoundMenuImpl.java
private void putOnPage(Integer page, Collection<? extends IElement> element) {
        if (page > pagecount) pagecount = page;
        List<IElement> pe = pageelements.getOrDefault(page, new LinkedList<>());
        for (IElement elem : element)
            if (elem instanceof IElementImpl) {
                //bind the element to this menu
                ((IElementImpl) elem).setParent(this);
                //create a position, if missing
                SlotPos pos = elem.getPosition();
                if (pos == null) {
                    pos = menu.positionProvider.next(lastPutPosition.get(page));
                    elem.setPosition(pos);
                }
                lastPutPosition.put(page, pos);
            }
        pe.addAll(element);
        pageelements.put(page, pe);
    }
/**
     * internal shared implementation to put elements on a page. check must already have happened
     * @param page the target page
     * @param element the elements to put on the page
     */
internal shared implementation to put elements on a page. check must already have happened
@param page the target page
@param element the elements to put on the page
internal shared implementation to put elements on a page . check must already have happened @param page the target page @param element the elements to put on the page
private void putOnPage(Integer page, Collection<? extends IElement> element) {
        if (page > pagecount) pagecount = page;
        List<IElement> pe = pageelements.getOrDefault(page, new LinkedList<>());
        for (IElement elem : element)
            if (elem instanceof IElementImpl) {
                ((IElementImpl) elem).setParent(this);
                SlotPos pos = elem.getPosition();
                if (pos == null) {
                    pos = menu.positionProvider.next(lastPutPosition.get(page));
                    elem.setPosition(pos);
                }
                lastPutPosition.put(page, pos);
            }
        pe.addAll(element);
        pageelements.put(page, pe);
    }
private void putOnPage ( Integer page , Collection < ? extends IElement > element ) { if ( page > pagecount ) pagecount = page ; List < IElement > pe = pageelements . getOrDefault ( page , new LinkedList < > ( ) ) ; for ( IElement elem : element ) if ( elem instanceof IElementImpl ) { ( ( IElementImpl ) elem ) . setParent ( this ) ; SlotPos pos = elem . getPosition ( ) ; if ( pos == null ) { pos = menu . positionProvider . next ( lastPutPosition . get ( page ) ) ; elem . setPosition ( pos ) ; } lastPutPosition . put ( page , pos ) ; } pe . addAll ( element ) ; pageelements . put ( page , pe ) ; }
internal shared implementation to put elements on a page.
internal shared implementation to put elements on a page .
//bind the element to this menu //create a position, if missing