Search in sources :

Example 1 with Entry

use of org.freeplane.core.ui.menubuilders.generic.Entry 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 Entry

use of org.freeplane.core.ui.menubuilders.generic.Entry 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 Entry

use of org.freeplane.core.ui.menubuilders.generic.Entry 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 Entry

use of org.freeplane.core.ui.menubuilders.generic.Entry 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 Entry

use of org.freeplane.core.ui.menubuilders.generic.Entry in project freeplane by freeplane.

the class JMenuItemBuilderTest method createsGroupWithAction.

@Test
public void createsGroupWithAction() {
    Entry parentMenuEntry = new Entry();
    final JMenu parentMenu = new JMenu();
    new EntryAccessor().setComponent(parentMenuEntry, parentMenu);
    parentMenuEntry.addChild(groupEntry);
    groupEntry.addChild(actionEntry);
    new EntryAccessor().setAction(groupEntry, action);
    menuActionGroupBuilder.visit(groupEntry);
    final JMenuItem menuItem = getFirstSubMenuItem(groupEntry);
    assertThatMenuItemHasCorrectAction(menuItem);
}
Also used : Entry(org.freeplane.core.ui.menubuilders.generic.Entry) EntryAccessor(org.freeplane.core.ui.menubuilders.generic.EntryAccessor) JMenuItem(javax.swing.JMenuItem) JMenu(javax.swing.JMenu) Test(org.junit.Test)

Aggregations

Entry (org.freeplane.core.ui.menubuilders.generic.Entry)64 Test (org.junit.Test)49 EntryAccessor (org.freeplane.core.ui.menubuilders.generic.EntryAccessor)36 AFreeplaneAction (org.freeplane.core.ui.AFreeplaneAction)22 JMenu (javax.swing.JMenu)9 Container (java.awt.Container)5 PhaseProcessor (org.freeplane.core.ui.menubuilders.generic.PhaseProcessor)5 SubtreeProcessor (org.freeplane.core.ui.menubuilders.generic.SubtreeProcessor)4 JComponent (javax.swing.JComponent)3 JMenuItem (javax.swing.JMenuItem)3 JPanel (javax.swing.JPanel)3 JToolBar (javax.swing.JToolBar)3 FreeplaneToolBar (org.freeplane.core.ui.components.FreeplaneToolBar)3 JToolbarComponentBuilder (org.freeplane.core.ui.menubuilders.menu.JToolbarComponentBuilder)3 Component (java.awt.Component)2 Collection (java.util.Collection)2 JButton (javax.swing.JButton)2 IUserInputListenerFactory (org.freeplane.core.ui.IUserInputListenerFactory)2 FreeplaneMenuBar (org.freeplane.core.ui.components.FreeplaneMenuBar)2 AcceleratebleActionProvider (org.freeplane.core.ui.menubuilders.action.AcceleratebleActionProvider)2