use of org.freeplane.core.ui.menubuilders.generic.EntryAccessor in project freeplane by freeplane.
the class JMenuItemBuilderTest method whenPopupMenuBecomesVisible_itsChildActionPopupListenerIsCalled.
@Test
public void whenPopupMenuBecomesVisible_itsChildActionPopupListenerIsCalled() {
menuEntry.addChild(actionEntry);
menuActionGroupBuilder.visit(menuEntry);
JMenu item = (JMenu) new EntryAccessor().getComponent(menuEntry);
item.getPopupMenu().setVisible(true);
verify(popupListener).childEntriesWillBecomeVisible(actionEntry);
}
use of org.freeplane.core.ui.menubuilders.generic.EntryAccessor in project freeplane by freeplane.
the class JMenuItemBuilderTest method createsMenuButtonWithAction.
@Test
public void createsMenuButtonWithAction() {
new EntryAccessor().setComponent(menuEntry, menu);
menuEntry.addChild(actionEntry);
menuActionGroupBuilder.visit(actionEntry);
JMenuItem item = (JMenuItem) new EntryAccessor().getComponent(actionEntry);
assertThatMenuItemHasCorrectAction(item);
assertThat(item.getParent(), CoreMatchers.<Container>equalTo(menu.getPopupMenu()));
}
use of org.freeplane.core.ui.menubuilders.generic.EntryAccessor in project freeplane by freeplane.
the class JMenuItemBuilderTest method createsMenuItemWithSelectableAction.
@Test
public void createsMenuItemWithSelectableAction() {
menuEntry.addChild(actionEntry);
when(action.isSelectable()).thenReturn(true);
new EntryAccessor().setComponent(menuEntry, menu);
menuActionGroupBuilder.visit(actionEntry);
JAutoCheckBoxMenuItem item = (JAutoCheckBoxMenuItem) new EntryAccessor().getComponent(actionEntry);
final AccelerateableAction itemAction = (AccelerateableAction) item.getAction();
assertThat(itemAction.getOriginalAction(), CoreMatchers.<Action>equalTo(action));
assertThat(item.getParent(), CoreMatchers.<Container>equalTo(menu.getPopupMenu()));
}
use of org.freeplane.core.ui.menubuilders.generic.EntryAccessor in project freeplane by freeplane.
the class JMenuItemBuilderTest method createsSubmenuWithoutAction.
@Test
public void createsSubmenuWithoutAction() {
Entry parentMenuEntry = new Entry();
final JMenu parentMenu = new JMenu();
new EntryAccessor().setComponent(parentMenuEntry, parentMenu);
parentMenuEntry.addChild(menuEntry);
menuEntry.addChild(actionEntry);
menuActionGroupBuilder.visit(menuEntry);
JMenu item = (JMenu) new EntryAccessor().getComponent(menuEntry);
assertThat(item.getParent(), CoreMatchers.<Container>equalTo(parentMenu.getPopupMenu()));
}
use of org.freeplane.core.ui.menubuilders.generic.EntryAccessor in project freeplane by freeplane.
the class JMenuItemBuilderTest method whenPopupMenuBecomesVisible_itsChildGroupPopupListenerIsCalled.
@Test
public void whenPopupMenuBecomesVisible_itsChildGroupPopupListenerIsCalled() {
menuEntry.addChild(groupEntry);
menuActionGroupBuilder.visit(menuEntry);
JMenu menu = (JMenu) new EntryAccessor().getComponent(menuEntry);
menu.getPopupMenu().setVisible(true);
verify(popupListener).childEntriesWillBecomeVisible(groupEntry);
}
Aggregations