Search in sources :

Example 1 with RecursiveMenuStructureProcessor

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

the class MenuBuilderIntegrationTest method buildJMenu.

private Entry buildJMenu(String content) {
    final Entry buildMenuStructure = XmlEntryStructureBuilder.buildMenuStructure(content);
    final RecursiveMenuStructureProcessor actionBuilder = new RecursiveMenuStructureProcessor();
    actionBuilder.setDefaultBuilder(new ActionFinder(freeplaneActions));
    new PhaseProcessor().withPhase(ACTIONS, actionBuilder).withPhase(UI, recursiveMenuStructureBuilder).build(buildMenuStructure);
    return buildMenuStructure;
}
Also used : Entry(org.freeplane.core.ui.menubuilders.generic.Entry) RecursiveMenuStructureProcessor(org.freeplane.core.ui.menubuilders.generic.RecursiveMenuStructureProcessor) PhaseProcessor(org.freeplane.core.ui.menubuilders.generic.PhaseProcessor) ActionFinder(org.freeplane.core.ui.menubuilders.action.ActionFinder)

Example 2 with RecursiveMenuStructureProcessor

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

the class MenuBuilderIntegrationTest method setup.

@Before
public void setup() {
    freeplaneActions = mock(FreeplaneActions.class);
    recursiveMenuStructureBuilder = new RecursiveMenuStructureProcessor();
    recursiveMenuStructureBuilder.setDefaultBuilderPair(EntryVisitor.EMTPY, EntryVisitor.EMTPY);
    final IUserInputListenerFactory userInputListenerFactory = mock(IUserInputListenerFactory.class);
    toolbar = new JToolBar();
    when(userInputListenerFactory.getToolBar("/main_toolbar")).thenReturn(toolbar);
    recursiveMenuStructureBuilder.addBuilder("toolbar", new JToolbarBuilder(userInputListenerFactory));
    recursiveMenuStructureBuilder.setSubtreeDefaultBuilderPair("toolbar", "toolbar.action");
    recursiveMenuStructureBuilder.addBuilderPair("toolbar.action", new BuilderDestroyerPair(new JToolbarComponentBuilder(), null));
}
Also used : RecursiveMenuStructureProcessor(org.freeplane.core.ui.menubuilders.generic.RecursiveMenuStructureProcessor) FreeplaneActions(org.freeplane.features.mode.FreeplaneActions) IUserInputListenerFactory(org.freeplane.core.ui.IUserInputListenerFactory) BuilderDestroyerPair(org.freeplane.core.ui.menubuilders.generic.BuilderDestroyerPair) JToolbarBuilder(org.freeplane.core.ui.menubuilders.menu.JToolbarBuilder) JToolbarComponentBuilder(org.freeplane.core.ui.menubuilders.menu.JToolbarComponentBuilder) JToolBar(javax.swing.JToolBar) Before(org.junit.Before)

Aggregations

RecursiveMenuStructureProcessor (org.freeplane.core.ui.menubuilders.generic.RecursiveMenuStructureProcessor)2 JToolBar (javax.swing.JToolBar)1 IUserInputListenerFactory (org.freeplane.core.ui.IUserInputListenerFactory)1 ActionFinder (org.freeplane.core.ui.menubuilders.action.ActionFinder)1 BuilderDestroyerPair (org.freeplane.core.ui.menubuilders.generic.BuilderDestroyerPair)1 Entry (org.freeplane.core.ui.menubuilders.generic.Entry)1 PhaseProcessor (org.freeplane.core.ui.menubuilders.generic.PhaseProcessor)1 JToolbarBuilder (org.freeplane.core.ui.menubuilders.menu.JToolbarBuilder)1 JToolbarComponentBuilder (org.freeplane.core.ui.menubuilders.menu.JToolbarComponentBuilder)1 FreeplaneActions (org.freeplane.features.mode.FreeplaneActions)1 Before (org.junit.Before)1