Search in sources :

Example 1 with MenuIdChooserImpl

use of com.thecoderscorner.menu.editorui.project.MenuIdChooserImpl in project tcMenu by davetcc.

the class RomLayoutController method init.

public void init(MenuTree menuTree) {
    menuIdChooser = new MenuIdChooserImpl(menuTree);
    menuIdChooser.getItemsSortedById().forEach((item) -> {
        Label lbl = new Label(item.getId() + " - " + item.getName());
        lbl.getStyleClass().add("idRomEntry");
        idContainer.getChildren().add(lbl);
    });
    List<MenuItem> sortedByEeprom = menuIdChooser.getItemsSortedByEeprom();
    sortedByEeprom.stream().filter((it) -> it.getEepromAddress() != -1).forEach((item) -> {
        int address = item.getEepromAddress();
        int addrSize = MenuItemHelper.eepromSizeForItem(item);
        int addrEnd = address + addrSize - 1;
        Label l = new Label(address + "-" + addrEnd + ": " + item.getName());
        Optional<String> maybeOverlap = overlapDetails(item, sortedByEeprom);
        if (maybeOverlap.isPresent()) {
            l.getStyleClass().add("brokenEeprom");
            l.setTooltip(new Tooltip(maybeOverlap.get()));
        } else {
            l.getStyleClass().add("eepromEntry");
        }
        l.setPrefWidth(eepromContainer.getPrefWidth());
        eepromContainer.getChildren().add(l);
    });
}
Also used : Button(javafx.scene.control.Button) Label(javafx.scene.control.Label) MenuItem(com.thecoderscorner.menu.domain.MenuItem) MenuItemHelper(com.thecoderscorner.menu.domain.util.MenuItemHelper) MenuIdChooser(com.thecoderscorner.menu.editorui.project.MenuIdChooser) VBox(javafx.scene.layout.VBox) ActionEvent(javafx.event.ActionEvent) List(java.util.List) Stage(javafx.stage.Stage) Optional(java.util.Optional) MenuIdChooserImpl(com.thecoderscorner.menu.editorui.project.MenuIdChooserImpl) MenuTree(com.thecoderscorner.menu.domain.state.MenuTree) Tooltip(javafx.scene.control.Tooltip) Tooltip(javafx.scene.control.Tooltip) MenuIdChooserImpl(com.thecoderscorner.menu.editorui.project.MenuIdChooserImpl) Label(javafx.scene.control.Label) MenuItem(com.thecoderscorner.menu.domain.MenuItem)

Aggregations

MenuItem (com.thecoderscorner.menu.domain.MenuItem)1 MenuTree (com.thecoderscorner.menu.domain.state.MenuTree)1 MenuItemHelper (com.thecoderscorner.menu.domain.util.MenuItemHelper)1 MenuIdChooser (com.thecoderscorner.menu.editorui.project.MenuIdChooser)1 MenuIdChooserImpl (com.thecoderscorner.menu.editorui.project.MenuIdChooserImpl)1 List (java.util.List)1 Optional (java.util.Optional)1 ActionEvent (javafx.event.ActionEvent)1 Button (javafx.scene.control.Button)1 Label (javafx.scene.control.Label)1 Tooltip (javafx.scene.control.Tooltip)1 VBox (javafx.scene.layout.VBox)1 Stage (javafx.stage.Stage)1