Search in sources :

Example 11 with Entry

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

the class MenuBuildProcessFactoryTest method ifProcessOnPopupIsSet_buildsWhenItBecomesVisible.

@Test
public void ifProcessOnPopupIsSet_buildsWhenItBecomesVisible() throws Exception {
    final Entry menuStructure = XmlEntryStructureBuilder.buildMenuStructure("<Entry builder='main_menu'>" + "<Entry name='submenu'>" + "<Entry name='submenu' processOnPopup='true'>" + "<Entry name='action'/>" + "</Entry>" + "</Entry>" + "</Entry>");
    phaseProcessor.build(menuStructure);
    final Entry openedEntry = menuStructure.getChild(0, 0, 0);
    JMenu menu = (JMenu) new EntryAccessor().getComponent(openedEntry);
    menu.getPopupMenu().setVisible(true);
    verify(freeplaneActions).getAction("action");
}
Also used : Entry(org.freeplane.core.ui.menubuilders.generic.Entry) EntryAccessor(org.freeplane.core.ui.menubuilders.generic.EntryAccessor) JMenu(javax.swing.JMenu) Test(org.junit.Test)

Example 12 with Entry

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

the class ToolbarComponentProviderTest method testName.

@Test
public void testName() throws Exception {
    final ToolbarComponentProvider toolbarComponentProvider = new ToolbarComponentProvider();
    final Entry entry = new Entry();
    final EntryAccessor entryAccessor = new EntryAccessor();
    final Object testComponent = new JPanel();
    entryAccessor.setComponent(entry, testComponent);
    Assert.assertThat(toolbarComponentProvider.createComponent(entry), equalTo(testComponent));
}
Also used : JPanel(javax.swing.JPanel) Entry(org.freeplane.core.ui.menubuilders.generic.Entry) EntryAccessor(org.freeplane.core.ui.menubuilders.generic.EntryAccessor) Test(org.junit.Test)

Example 13 with Entry

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

the class JMenuRadioGroupBuilder method visit.

@Override
public void visit(Entry target) {
    ButtonGroup buttonGroup = new ButtonGroup();
    final MenuRadioActionComponentProvider menuActionComponentProvider = new MenuRadioActionComponentProvider(accelerators, acceleratebleActionProvider, resourceAccessor, buttonGroup);
    JMenuItemBuilder menuItemBuilder = new JMenuItemBuilder(popupListener, menuActionComponentProvider, resourceAccessor);
    menuItemBuilder.visit(target);
    for (Entry childEntry : target.children()) {
        menuItemBuilder.visit(childEntry);
    }
}
Also used : Entry(org.freeplane.core.ui.menubuilders.generic.Entry) ButtonGroup(javax.swing.ButtonGroup)

Example 14 with Entry

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

the class BToolbarContributor method visit.

@Override
public void visit(Entry target) {
    final EntryAccessor entryAccessor = new EntryAccessor();
    final Entry label = new Entry();
    target.addChild(label);
    entryAccessor.setComponent(label, new JLabel("URL:"));
    final Entry field = new Entry();
    target.addChild(field);
    entryAccessor.setComponent(field, urlfield);
}
Also used : Entry(org.freeplane.core.ui.menubuilders.generic.Entry) EntryAccessor(org.freeplane.core.ui.menubuilders.generic.EntryAccessor) JLabel(javax.swing.JLabel)

Example 15 with Entry

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

the class UserInputListenerFactory method createMapActions.

private void createMapActions(final Entry mapsMenuEntry) {
    final IMapViewManager mapViewManager = Controller.getCurrentController().getMapViewManager();
    final ViewController viewController = Controller.getCurrentController().getViewController();
    final List<? extends Component> mapViewVector = viewController.getMapViewVector();
    if (mapViewVector == null) {
        return;
    }
    EntryAccessor entryAccessor = new EntryAccessor();
    for (final Component mapView : mapViewVector) {
        final String displayName = mapView.getName();
        Entry actionEntry = new Entry();
        final MapsMenuAction action = new MapsMenuAction(displayName);
        actionEntry.setName(action.getKey());
        modeController.addActionIfNotAlreadySet(action);
        entryAccessor.setAction(actionEntry, action);
        final MapView currentMapView = (MapView) mapViewManager.getMapViewComponent();
        if (currentMapView != null) {
            if (mapView == currentMapView) {
                actionEntry.setAttribute("selected", true);
            }
        }
        mapsMenuEntry.addChild(actionEntry);
    }
}
Also used : IMapViewManager(org.freeplane.features.ui.IMapViewManager) Entry(org.freeplane.core.ui.menubuilders.generic.Entry) ViewController(org.freeplane.features.ui.ViewController) EntryAccessor(org.freeplane.core.ui.menubuilders.generic.EntryAccessor) MapView(org.freeplane.view.swing.map.MapView) Component(java.awt.Component) JComponent(javax.swing.JComponent)

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