@Test public void menuPath() { List<String> path = new ArrayList<>(); Platform.runLater(() -> { Menu menuFile = new Menu("File"); MenuItem add = new MenuItem("Shuffle"); MenuItem clear = new MenuItem("Clear"); MenuItem exit = new MenuItem("Exit"); menuFile.getItems().addAll(add, clear, new SeparatorMenuItem(), exit); RFXMenuItem rfxMenuItem = new RFXMenuItem(null, null); path.add(rfxMenuItem.getSelectedMenuPath(clear)); }); new Wait("Waiting for menu selection path") { @Override public boolean until() { return path.size() > 0; } }; AssertJUnit.assertEquals("File>>Clear", path.get(0)); }
public String getSelectedMenuPath(MenuItem menuItem) { LinkedList<String> pathText = new LinkedList<>(); while (menuItem != null) { String textForMenu = getTextForMenuItem(menuItem); pathText.addFirst(escapeSpecialCharacters(textForMenu)); menuItem = menuItem.getParentMenu(); } return buildSelectedMenuPath(pathText); }
RFXMenuItem extends RFXComponent { public String getSelectedMenuPath(MenuItem menuItem) { LinkedList<String> pathText = new LinkedList<>(); while (menuItem != null) { String textForMenu = getTextForMenuItem(menuItem); pathText.addFirst(escapeSpecialCharacters(textForMenu)); menuItem = menuItem.getParentMenu(); } return buildSelectedMenuPath(pathText); } }
RFXMenuItem extends RFXComponent { public String getSelectedMenuPath(MenuItem menuItem) { LinkedList<String> pathText = new LinkedList<>(); while (menuItem != null) { String textForMenu = getTextForMenuItem(menuItem); pathText.addFirst(escapeSpecialCharacters(textForMenu)); menuItem = menuItem.getParentMenu(); } return buildSelectedMenuPath(pathText); } RFXMenuItem(IJSONRecorder recorder, JSONOMapConfig oMapConfig); }
RFXMenuItem extends RFXComponent { public String getSelectedMenuPath(MenuItem menuItem) { LinkedList<String> pathText = new LinkedList<>(); while (menuItem != null) { String textForMenu = getTextForMenuItem(menuItem); pathText.addFirst(escapeSpecialCharacters(textForMenu)); menuItem = menuItem.getParentMenu(); } return buildSelectedMenuPath(pathText); } RFXMenuItem(IJSONRecorder recorder, JSONOMapConfig oMapConfig); void record(ActionEvent event); String getSelectedMenuPath(MenuItem menuItem); String getTextForMenuItem(MenuItem menuItem); }
RFXMenuItem extends RFXComponent { public String getSelectedMenuPath(MenuItem menuItem) { LinkedList<String> pathText = new LinkedList<>(); while (menuItem != null) { String textForMenu = getTextForMenuItem(menuItem); pathText.addFirst(escapeSpecialCharacters(textForMenu)); menuItem = menuItem.getParentMenu(); } return buildSelectedMenuPath(pathText); } RFXMenuItem(IJSONRecorder recorder, JSONOMapConfig oMapConfig); void record(ActionEvent event); String getSelectedMenuPath(MenuItem menuItem); String getTextForMenuItem(MenuItem menuItem); static final Logger LOGGER; }