Search in sources :

Example 1 with PhaseProcessor

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);
}
Also used : Entry(org.freeplane.core.ui.menubuilders.generic.Entry) PhaseProcessor(org.freeplane.core.ui.menubuilders.generic.PhaseProcessor) SubtreeProcessor(org.freeplane.core.ui.menubuilders.generic.SubtreeProcessor) Test(org.junit.Test)

Example 2 with PhaseProcessor

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);
}
Also used : Entry(org.freeplane.core.ui.menubuilders.generic.Entry) PhaseProcessor(org.freeplane.core.ui.menubuilders.generic.PhaseProcessor) SubtreeProcessor(org.freeplane.core.ui.menubuilders.generic.SubtreeProcessor) Test(org.junit.Test)

Example 3 with PhaseProcessor

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);
}
Also used : Entry(org.freeplane.core.ui.menubuilders.generic.Entry) PhaseProcessor(org.freeplane.core.ui.menubuilders.generic.PhaseProcessor) SubtreeProcessor(org.freeplane.core.ui.menubuilders.generic.SubtreeProcessor) Test(org.junit.Test)

Example 4 with PhaseProcessor

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);
}
Also used : Entry(org.freeplane.core.ui.menubuilders.generic.Entry) PhaseProcessor(org.freeplane.core.ui.menubuilders.generic.PhaseProcessor) SubtreeProcessor(org.freeplane.core.ui.menubuilders.generic.SubtreeProcessor) Test(org.junit.Test)

Example 5 with PhaseProcessor

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);
}
Also used : BuildPhaseListener(org.freeplane.core.ui.menubuilders.generic.BuildPhaseListener) InputStreamReader(java.io.InputStreamReader) IUserInputListenerFactory(org.freeplane.core.ui.IUserInputListenerFactory) EntriesForAction(org.freeplane.core.ui.menubuilders.action.EntriesForAction) InputStream(java.io.InputStream) PhaseProcessor(org.freeplane.core.ui.menubuilders.generic.PhaseProcessor) BufferedReader(java.io.BufferedReader) JToolBar(javax.swing.JToolBar) JPopupMenu(javax.swing.JPopupMenu) MenuBuildProcessFactory(org.freeplane.core.ui.menubuilders.menu.MenuBuildProcessFactory) BeforeClass(org.junit.BeforeClass)

Aggregations

PhaseProcessor (org.freeplane.core.ui.menubuilders.generic.PhaseProcessor)6 Entry (org.freeplane.core.ui.menubuilders.generic.Entry)5 SubtreeProcessor (org.freeplane.core.ui.menubuilders.generic.SubtreeProcessor)4 Test (org.junit.Test)4 BufferedReader (java.io.BufferedReader)1 InputStream (java.io.InputStream)1 InputStreamReader (java.io.InputStreamReader)1 JPopupMenu (javax.swing.JPopupMenu)1 JToolBar (javax.swing.JToolBar)1 IUserInputListenerFactory (org.freeplane.core.ui.IUserInputListenerFactory)1 ActionFinder (org.freeplane.core.ui.menubuilders.action.ActionFinder)1 EntriesForAction (org.freeplane.core.ui.menubuilders.action.EntriesForAction)1 BuildPhaseListener (org.freeplane.core.ui.menubuilders.generic.BuildPhaseListener)1 RecursiveMenuStructureProcessor (org.freeplane.core.ui.menubuilders.generic.RecursiveMenuStructureProcessor)1 MenuBuildProcessFactory (org.freeplane.core.ui.menubuilders.menu.MenuBuildProcessFactory)1 BeforeClass (org.junit.BeforeClass)1