Search in sources :

Example 6 with IBrowserColumnItem

use of de.mossgrabers.framework.daw.data.IBrowserColumnItem in project DrivenByMoss by git-moss.

the class BrowseMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    final ITextDisplay d = this.surface.getTextDisplay();
    final IBrowser browser = this.model.getBrowser();
    if (!browser.isActive())
        return;
    d.clear();
    String selectedResult;
    switch(this.selectionMode) {
        case BrowseMode.SELECTION_OFF:
            d.setCell(0, 0, "BROWSE").setCell(1, 0, browser.getSelectedContentType().toUpperCase(Locale.US));
            selectedResult = browser.getSelectedResult();
            d.setCell(0, 8, "SELECTED").setCell(1, 8, selectedResult == null ? "NONE" : selectedResult);
            for (int i = 0; i < 7; i++) {
                final IBrowserColumn column = browser.getFilterColumn(i);
                d.setCell(0, 1 + i, StringUtils.shortenAndFixASCII(column.getName() + ":", 8).toUpperCase(Locale.US)).setCell(1, 1 + i, column.doesCursorExist() ? column.getCursorName().toUpperCase(Locale.US) : "");
            }
            break;
        case BrowseMode.SELECTION_PRESET:
            d.setCell(0, 0, "SELECTED");
            final IBrowserColumnItem[] results = browser.getResultColumnItems();
            for (int i = 0; i < 16; i++) d.setCell(i % 2, 1 + i / 2, (results[i].isSelected() ? ">" : " ") + results[i].getName().toUpperCase(Locale.US));
            break;
        case BrowseMode.SELECTION_FILTER:
            final IBrowserColumn fc = browser.getFilterColumn(this.filterColumn);
            d.setCell(0, 0, fc.getName().toUpperCase(Locale.US));
            final IBrowserColumnItem[] items = fc.getItems();
            for (int i = 0; i < 16; i++) {
                final String name = items[i].getName().toUpperCase(Locale.US);
                final String text = (items[i].isSelected() ? ">" : " ") + name;
                d.setCell(i % 2, 1 + i / 2, text);
            }
            break;
        default:
            // No more modes
            break;
    }
    d.allDone();
}
Also used : IBrowser(de.mossgrabers.framework.daw.IBrowser) IBrowserColumnItem(de.mossgrabers.framework.daw.data.IBrowserColumnItem) IBrowserColumn(de.mossgrabers.framework.daw.data.IBrowserColumn) ITextDisplay(de.mossgrabers.framework.controller.display.ITextDisplay)

Example 7 with IBrowserColumnItem

use of de.mossgrabers.framework.daw.data.IBrowserColumnItem in project DrivenByMoss by git-moss.

the class BrowserImpl method enableObservers.

/**
 * {@inheritDoc}
 */
@Override
public void enableObservers(final boolean enable) {
    this.browser.exists().setIsSubscribed(enable);
    this.browser.selectedContentTypeIndex().setIsSubscribed(enable);
    this.browser.selectedContentTypeName().setIsSubscribed(enable);
    this.browser.contentTypeNames().setIsSubscribed(enable);
    for (final IBrowserColumn column : this.columnData) column.enableObservers(enable);
    this.cursorResult.name().setIsSubscribed(enable);
    for (final IBrowserColumnItem item : this.resultData) item.enableObservers(enable);
}
Also used : IBrowserColumnItem(de.mossgrabers.framework.daw.data.IBrowserColumnItem) IBrowserColumn(de.mossgrabers.framework.daw.data.IBrowserColumn)

Example 8 with IBrowserColumnItem

use of de.mossgrabers.framework.daw.data.IBrowserColumnItem in project DrivenByMoss by git-moss.

the class BrowserColumnImpl method enableObservers.

/**
 * {@inheritDoc}
 */
@Override
public void enableObservers(final boolean enable) {
    this.column.exists().setIsSubscribed(enable);
    this.column.name().setIsSubscribed(enable);
    this.column.getWildcardItem().name().setIsSubscribed(enable);
    this.itemBank.cursorIndex().setIsSubscribed(enable);
    for (final IBrowserColumnItem item : this.items) item.enableObservers(enable);
    this.cursorResult.exists().setIsSubscribed(enable);
    this.cursorResult.name().setIsSubscribed(enable);
}
Also used : IBrowserColumnItem(de.mossgrabers.framework.daw.data.IBrowserColumnItem)

Example 9 with IBrowserColumnItem

use of de.mossgrabers.framework.daw.data.IBrowserColumnItem in project DrivenByMoss by git-moss.

the class OSCWriter method flushBrowser.

private void flushBrowser(final String browserAddress, final IBrowser browser, final boolean dump) {
    this.sendOSC(browserAddress + "isActive", browser.isActive(), dump);
    this.sendOSC(browserAddress + "tab", browser.getSelectedContentType(), dump);
    IBrowserColumn column;
    // Filter Columns
    for (int i = 0; i < browser.getFilterColumnCount(); i++) {
        final String filterAddress = browserAddress + "filter/" + (i + 1) + "/";
        column = browser.getFilterColumn(i);
        this.sendOSC(filterAddress + "exists", column.doesExist(), dump);
        this.sendOSC(filterAddress + "name", column.getName(), dump);
        this.sendOSC(filterAddress + "wildcard", column.getWildcard(), dump);
        final IBrowserColumnItem[] items = column.getItems();
        for (int j = 0; j < items.length; j++) {
            this.sendOSC(filterAddress + "item/" + (j + 1) + "/exists", items[j].doesExist(), dump);
            this.sendOSC(filterAddress + "item/" + (j + 1) + "/name", items[j].getName(), dump);
            this.sendOSC(filterAddress + "item/" + (j + 1) + "/hits", items[j].getHitCount(), dump);
            this.sendOSC(filterAddress + "item/" + (j + 1) + "/isSelected", items[j].isSelected(), dump);
        }
    }
    // Presets
    final String presetAddress = browserAddress + "result/";
    final IBrowserColumnItem[] items = browser.getResultColumnItems();
    for (int i = 0; i < items.length; i++) {
        this.sendOSC(presetAddress + (i + 1) + "/exists", items[i].doesExist(), dump);
        this.sendOSC(presetAddress + (i + 1) + "/name", items[i].getName(), dump);
        this.sendOSC(presetAddress + (i + 1) + "/hits", items[i].getHitCount(), dump);
        this.sendOSC(presetAddress + (i + 1) + "/isSelected", items[i].isSelected(), dump);
    }
}
Also used : IBrowserColumnItem(de.mossgrabers.framework.daw.data.IBrowserColumnItem) IBrowserColumn(de.mossgrabers.framework.daw.data.IBrowserColumn)

Example 10 with IBrowserColumnItem

use of de.mossgrabers.framework.daw.data.IBrowserColumnItem in project DrivenByMoss by git-moss.

the class DeviceBrowserMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    final IBrowser browser = this.model.getBrowser();
    final Display d = this.surface.getDisplay();
    final boolean isPresetSession = browser.isPresetContentType();
    final ICursorDevice cd = this.model.getCursorDevice();
    if (isPresetSession && !(browser.isActive() && cd.hasSelectedDevice())) {
        d.notify("No active Browsing Session. Select device and press Browser...");
        return;
    }
    d.clear();
    switch(this.selectionMode) {
        case SELECTION_OFF:
            for (int i = 0; i < 7; i++) {
                final IBrowserColumn column = this.getFilterColumn(i);
                final String value = column != null && column.doesCursorExist() ? column.getCursorName().equals(column.getWildcard()) ? "-" : column.getCursorName() : "";
                final String name = column == null ? "" : StringUtils.shortenAndFixASCII(column.getName(), 6);
                d.setCell(0, i, name).setCell(1, i, value);
            }
            final String selectedResult = browser.getSelectedResult();
            d.setCell(0, 7, browser.getSelectedContentType()).setCell(1, 7, selectedResult == null || selectedResult.length() == 0 ? "-" : selectedResult);
            break;
        case SELECTION_PRESET:
            final IBrowserColumnItem[] results = browser.getResultColumnItems();
            for (int i = 0; i < browser.getNumFilterColumnEntries(); i++) {
                if (i < results.length)
                    d.setBlock(i / 4, i % 4, (results[i].isSelected() ? ">" : " ") + StringUtils.fixASCII(results[i].getName()));
                else
                    break;
            }
            break;
        case SELECTION_FILTER:
            final IBrowserColumnItem[] items = browser.getFilterColumn(this.filterColumn).getItems();
            for (int i = 0; i < browser.getNumResults(); i++) d.setBlock(i / 4, i % 4, (items[i].isSelected() ? ">" : " ") + StringUtils.fixASCII(items[i].getName()));
            break;
    }
    d.allDone();
}
Also used : IBrowser(de.mossgrabers.framework.daw.IBrowser) IBrowserColumnItem(de.mossgrabers.framework.daw.data.IBrowserColumnItem) IBrowserColumn(de.mossgrabers.framework.daw.data.IBrowserColumn) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice) Display(de.mossgrabers.framework.controller.display.Display)

Aggregations

IBrowserColumnItem (de.mossgrabers.framework.daw.data.IBrowserColumnItem)15 IBrowserColumn (de.mossgrabers.framework.daw.data.IBrowserColumn)13 IBrowser (de.mossgrabers.framework.daw.IBrowser)11 Display (de.mossgrabers.framework.controller.display.Display)3 ITextDisplay (de.mossgrabers.framework.controller.display.ITextDisplay)3 PushDisplay (de.mossgrabers.push.controller.PushDisplay)2 ColorEx (de.mossgrabers.framework.controller.color.ColorEx)1 ICursorDevice (de.mossgrabers.framework.daw.ICursorDevice)1 ICursorDevice (de.mossgrabers.framework.daw.data.ICursorDevice)1 DisplayMessage (de.mossgrabers.push.controller.DisplayMessage)1 SLDisplay (de.mossgrabers.sl.controller.SLDisplay)1