Search in sources :

Example 16 with Entry

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

the class UserInputListenerFactory method rebuildMenuOnMapChange.

private void rebuildMenuOnMapChange(final Entry entry) {
    Entry menuEntry;
    for (// 
    menuEntry = entry.getParent(); // 
    menuEntry.getName().isEmpty(); menuEntry = menuEntry.getParent()) ;
    mapMenuEntries.put(menuEntry, null);
}
Also used : Entry(org.freeplane.core.ui.menubuilders.generic.Entry)

Example 17 with Entry

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

the class MenuBuilderIntegrationTest method createsEmptyToolbarComponent.

@Test
public void createsEmptyToolbarComponent() {
    String content = "<FreeplaneUIEntries>" + "<Entry name='home' builder='toolbar'/>" + "</FreeplaneUIEntries>";
    Entry builtMenuStructure = buildJMenu(content);
    assertThat(new EntryAccessor().getComponent(builtMenuStructure.getChild(0)), CoreMatchers.<Object>is(toolbar));
}
Also used : Entry(org.freeplane.core.ui.menubuilders.generic.Entry) EntryAccessor(org.freeplane.core.ui.menubuilders.generic.EntryAccessor) Test(org.junit.Test)

Example 18 with Entry

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

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

the class XmlEntryStructureBuilderTest method givenXmlWithChildEntryWithOneBuilder_createsStructureWithChildEntry.

@Test
public void givenXmlWithChildEntryWithOneBuilder_createsStructureWithChildEntry() {
    String xmlWithoutContent = "<FreeplaneUIEntries><Entry builder='builder'/></FreeplaneUIEntries>";
    Entry builtMenuStructure = XmlEntryStructureBuilder.buildMenuStructure(xmlWithoutContent);
    Entry menuStructureWithChildEntry = new Entry();
    final Entry childEntry = new Entry();
    childEntry.setBuilders(asList("builder"));
    menuStructureWithChildEntry.addChild(childEntry);
    assertThat(builtMenuStructure, equalTo(menuStructureWithChildEntry));
}
Also used : Entry(org.freeplane.core.ui.menubuilders.generic.Entry) Test(org.junit.Test)

Example 20 with Entry

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

the class XmlEntryStructureBuilderTest method givenXmlWithChildEntryWithName_createsStructureWithNamedChildEntry.

@Test
public void givenXmlWithChildEntryWithName_createsStructureWithNamedChildEntry() {
    String xmlWithoutContent = "<FreeplaneUIEntries><Entry name='entry'/></FreeplaneUIEntries>";
    Entry builtMenuStructure = XmlEntryStructureBuilder.buildMenuStructure(xmlWithoutContent);
    Entry menuStructureWithChildEntry = new Entry();
    final Entry childEntry = new Entry();
    childEntry.setName("entry");
    menuStructureWithChildEntry.addChild(childEntry);
    assertThat(builtMenuStructure, equalTo(menuStructureWithChildEntry));
}
Also used : Entry(org.freeplane.core.ui.menubuilders.generic.Entry) 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