Search in sources :

Example 1 with RuntimeListMenuItemBuilder

use of com.thecoderscorner.menu.domain.RuntimeListMenuItemBuilder in project tcMenu by davetcc.

the class UIRuntimeListMenuItem method getChangedMenuItem.

@Override
protected Optional<RuntimeListMenuItem> getChangedMenuItem() {
    RuntimeListMenuItemBuilder builder = RuntimeListMenuItemBuilder.aRuntimeListMenuItemBuilder().withExisting(getMenuItem());
    List<FieldError> errors = new ArrayList<>();
    getChangedDefaults(builder, errors);
    RuntimeListMenuItem item = builder.menuItem();
    functionNameTextField.setText(item.getFunctionName());
    return getItemOrReportError(item, errors);
}
Also used : RuntimeListMenuItemBuilder(com.thecoderscorner.menu.domain.RuntimeListMenuItemBuilder) ArrayList(java.util.ArrayList) RuntimeListMenuItem(com.thecoderscorner.menu.domain.RuntimeListMenuItem)

Example 2 with RuntimeListMenuItemBuilder

use of com.thecoderscorner.menu.domain.RuntimeListMenuItemBuilder in project tcMenu by davetcc.

the class EmbeddedJavaGeneratorTest method setupGenerator.

@BeforeEach
public void setupGenerator() throws IOException {
    storage = mock(ConfigurationStorage.class);
    generator = new EmbeddedJavaGenerator(storage, EmbeddedPlatform.RASPBERRY_PIJ);
    tempPath = Files.createTempDirectory("gentest");
    tree = buildSimpleTreeReadOnly();
    tree.addMenuItem(MenuTree.ROOT, new RuntimeListMenuItemBuilder().withId(2039).withName("My List").withFunctionName("listHasChanged").withInitialRows(10).menuItem());
    when(storage.getVersion()).thenReturn("1.2.3");
    var pluginMgr = new DefaultXmlPluginLoader(new PluginEmbeddedPlatformsImpl(), storage, true);
    var data = Objects.requireNonNull(getClass().getResourceAsStream("/plugins/java-test-plugin.xml")).readAllBytes();
    plugin = pluginMgr.loadPlugin(new String(data));
}
Also used : RuntimeListMenuItemBuilder(com.thecoderscorner.menu.domain.RuntimeListMenuItemBuilder) PluginEmbeddedPlatformsImpl(com.thecoderscorner.menu.editorui.generator.plugin.PluginEmbeddedPlatformsImpl) ConfigurationStorage(com.thecoderscorner.menu.editorui.storage.ConfigurationStorage) DefaultXmlPluginLoader(com.thecoderscorner.menu.editorui.generator.plugin.DefaultXmlPluginLoader) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

RuntimeListMenuItemBuilder (com.thecoderscorner.menu.domain.RuntimeListMenuItemBuilder)2 RuntimeListMenuItem (com.thecoderscorner.menu.domain.RuntimeListMenuItem)1 DefaultXmlPluginLoader (com.thecoderscorner.menu.editorui.generator.plugin.DefaultXmlPluginLoader)1 PluginEmbeddedPlatformsImpl (com.thecoderscorner.menu.editorui.generator.plugin.PluginEmbeddedPlatformsImpl)1 ConfigurationStorage (com.thecoderscorner.menu.editorui.storage.ConfigurationStorage)1 ArrayList (java.util.ArrayList)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1