Search in sources :

Example 1 with FloatMenuItemBuilder

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

the class TagValMenuCommandProtocolTest method testWritingFloatItem.

@Test
public void testWritingFloatItem() {
    FloatMenuItem floatItem = DomainFixtures.aFloatMenu("FloatMenu", 1);
    floatItem = new FloatMenuItemBuilder().withExisting(floatItem).withVisible(false).menuItem();
    protocol.toChannel(bb, new MenuFloatBootCommand(22, floatItem, (float) 12.0));
    testBufferAgainstExpected(FLOAT_BOOT_ITEM, "PI=22|ID=1|IE=105|NM=FloatMenu|RO=0|VI=0|FD=3|VC=12.0|\u0002");
}
Also used : FloatMenuItem(com.thecoderscorner.menu.domain.FloatMenuItem) FloatMenuItemBuilder(com.thecoderscorner.menu.domain.FloatMenuItemBuilder) Test(org.junit.Test)

Example 2 with FloatMenuItemBuilder

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

the class UIFloatMenuItem method getChangedMenuItem.

@Override
protected Optional<FloatMenuItem> getChangedMenuItem() {
    List<FieldError> errors = new ArrayList<>();
    int dp = safeIntFromProperty(decimalPlaces.textProperty(), "Decimal Places", errors, 1, 6);
    FloatMenuItemBuilder builder = FloatMenuItemBuilder.aFloatMenuItemBuilder().withExisting(getMenuItem()).withDecimalPlaces(dp);
    getChangedDefaults(builder, errors);
    return getItemOrReportError(builder.menuItem(), errors);
}
Also used : ArrayList(java.util.ArrayList) FloatMenuItemBuilder(com.thecoderscorner.menu.domain.FloatMenuItemBuilder)

Aggregations

FloatMenuItemBuilder (com.thecoderscorner.menu.domain.FloatMenuItemBuilder)2 FloatMenuItem (com.thecoderscorner.menu.domain.FloatMenuItem)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1