use of de.mossgrabers.framework.utils.Pair in project DrivenByMoss by git-moss.
the class AbstractGraphicDisplay method addListElement.
/**
* {@inheritDoc}
*/
@Override
public void addListElement(final String[] items, final boolean[] selected) {
final List<Pair<String, Boolean>> menu = new ArrayList<>();
for (int i = 0; i < items.length; i++) menu.add(new Pair<>(items[i], Boolean.valueOf(selected[i])));
this.addElement(new ListComponent(menu));
}
use of de.mossgrabers.framework.utils.Pair in project DrivenByMoss by git-moss.
the class SessionMode method updateDisplay2Clips.
private void updateDisplay2Clips(final IGraphicDisplay display) {
final ITrackBank tb = this.model.getCurrentTrackBank();
final int numTracks = tb.getPageSize();
final int numScenes = tb.getSceneBank().getPageSize();
final boolean flipSession = this.surface.getConfiguration().isFlipSession();
final int maxCols = flipSession ? numScenes : numTracks;
int maxRows = flipSession ? numTracks : numScenes;
if (this.rowDisplayMode != RowDisplayMode.ALL)
maxRows = maxRows / 2;
for (int col = 0; col < maxCols; col++) {
final List<Pair<ITrack, ISlot>> slots = new ArrayList<>(maxRows);
for (int row = 0; row < maxRows; row++) {
int x = flipSession ? row : col;
int y = flipSession ? col : row;
if (this.rowDisplayMode == RowDisplayMode.LOWER) {
if (flipSession)
x += maxRows;
else
y += maxRows;
}
final ITrack track = tb.getItem(x);
slots.add(new Pair<>(track, track.getSlotBank().getItem(y)));
}
display.addSlotListElement(slots);
}
}
use of de.mossgrabers.framework.utils.Pair in project DrivenByMoss by git-moss.
the class AbstractGraphicDisplay method addListElement.
/**
* {@inheritDoc}
*/
@Override
public void addListElement(final int displaySize, final String[] elements, final int selectedIndex) {
final List<Pair<String, Boolean>> menu = new ArrayList<>();
final int startIndex = Math.max(0, Math.min(selectedIndex, elements.length - displaySize));
for (int i = 0; i < displaySize; i++) {
final int pos = startIndex + i;
final String itemName = pos < elements.length ? elements[pos] : "";
menu.add(new Pair<>(itemName, Boolean.valueOf(pos == selectedIndex)));
}
this.addElement(new ListComponent(menu));
}
Aggregations