use of org.freeplane.core.ui.menubuilders.generic.PhaseProcessor in project freeplane by freeplane.
the class SubtreeProcessorTest method doesNotDestroyEntriesWithoutDelay.
@Test
public void doesNotDestroyEntriesWithoutDelay() throws Exception {
final SubtreeProcessor childProcessor = new SubtreeProcessor();
final PhaseProcessor processor = mock(PhaseProcessor.class);
when(processor.forChildren(Mockito.<Entry>any(), Mockito.<Entry>any())).thenReturn(processor);
childProcessor.setProcessor(processor);
final Entry entry = new Entry();
final Entry child = new Entry();
entry.addChild(child);
childProcessor.childEntriesHidden(entry);
verify(processor, never()).destroy(child);
}
use of org.freeplane.core.ui.menubuilders.generic.PhaseProcessor in project freeplane by freeplane.
the class SubtreeProcessorTest method destroysEntriesWithDelay.
@Test
public void destroysEntriesWithDelay() throws Exception {
final SubtreeProcessor childProcessor = new SubtreeProcessor();
final PhaseProcessor processor = mock(PhaseProcessor.class);
when(processor.forChildren(Mockito.<Entry>any(), Mockito.<Entry>any())).thenReturn(processor);
childProcessor.setProcessor(processor);
final Entry entry = new Entry();
entry.setAttribute(RecursiveMenuStructureProcessor.PROCESS_ON_POPUP, true);
final Entry child = new Entry();
entry.addChild(child);
childProcessor.childEntriesHidden(entry);
verify(processor).destroy(child);
}
use of org.freeplane.core.ui.menubuilders.generic.PhaseProcessor in project freeplane by freeplane.
the class SubtreeProcessorTest method buildsEntriesWithDelay.
@Test
public void buildsEntriesWithDelay() throws Exception {
final SubtreeProcessor childProcessor = new SubtreeProcessor();
final PhaseProcessor processor = mock(PhaseProcessor.class);
when(processor.forChildren(Mockito.<Entry>any(), Mockito.<Entry>any())).thenReturn(processor);
childProcessor.setProcessor(processor);
final Entry entry = new Entry();
entry.setAttribute(RecursiveMenuStructureProcessor.PROCESS_ON_POPUP, true);
childProcessor.childEntriesWillBecomeVisible(entry);
verify(processor).buildChildren(entry);
}
use of org.freeplane.core.ui.menubuilders.generic.PhaseProcessor in project freeplane by freeplane.
the class SubtreeProcessorTest method doesNotBuildEntriesWithoutDelay.
@Test
public void doesNotBuildEntriesWithoutDelay() throws Exception {
final SubtreeProcessor childProcessor = new SubtreeProcessor();
final PhaseProcessor processor = mock(PhaseProcessor.class);
when(processor.forChildren(Mockito.<Entry>any(), Mockito.<Entry>any())).thenReturn(processor);
childProcessor.setProcessor(processor);
final Entry entry = new Entry();
final Entry child = new Entry();
entry.addChild(child);
childProcessor.childEntriesWillBecomeVisible(entry);
verify(processor, never()).build(child);
}
use of org.freeplane.core.ui.menubuilders.generic.PhaseProcessor in project freeplane by freeplane.
the class MenuBuilderAcceptanceTest method setup.
@BeforeClass
public static void setup() {
final IUserInputListenerFactory userInputListenerFactory = mock(IUserInputListenerFactory.class);
when(userInputListenerFactory.getToolBar("/main_toolbar")).thenReturn(new JToolBar());
when(userInputListenerFactory.getNodePopupMenu()).thenReturn(new JPopupMenu());
when(userInputListenerFactory.getMapPopup()).thenReturn(new JPopupMenu());
when(userInputListenerFactory.getMenuBar()).thenReturn(TestMenuBarFactory.createFreeplaneMenuBar());
final PhaseProcessor buildProcessor = new MenuBuildProcessFactory(userInputListenerFactory, Controller.getCurrentModeController(), new FreeplaneResourceAccessor(), mock(IAcceleratorMap.class), new EntriesForAction(), Collections.<BuildPhaseListener>emptyList()).getBuildProcessor();
final String menuResource = "/xml/mindmapmodemenu.xml";
final InputStream resource = MenuBuilderAcceptanceTest.class.getResourceAsStream(menuResource);
final BufferedReader reader = new BufferedReader(new InputStreamReader(resource));
menuStructure = XmlEntryStructureBuilder.buildMenuStructure(reader);
buildProcessor.build(menuStructure);
}
Aggregations