Search in sources :

Example 16 with EntryAccessor

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

the class FilterMenuBuilder method visit.

@Override
public void visit(Entry target) {
    final DefaultComboBoxModel filterConditions = filterController.getFilterConditions();
    final HashSet<String> usedNames = new HashSet<String>();
    for (int i = 0; i < filterConditions.getSize(); i++) {
        final ASelectableCondition condition = (ASelectableCondition) filterConditions.getElementAt(i);
        final String conditionName = condition.getUserName();
        if (conditionName != null && usedNames.add(conditionName)) {
            final ApplyNamedFilterAction action = new ApplyNamedFilterAction(filterController, condition);
            controller.addActionIfNotAlreadySet(action);
            new EntryAccessor().addChildAction(target, action);
        }
    }
}
Also used : EntryAccessor(org.freeplane.core.ui.menubuilders.generic.EntryAccessor) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) ASelectableCondition(org.freeplane.features.filter.condition.ASelectableCondition) HashSet(java.util.HashSet)

Example 17 with EntryAccessor

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

the class LastOpenedList method updateMenus.

private void updateMenus(ModeController modeController, Entry target) {
    List<AFreeplaneAction> openMapActions = createOpenLastMapActionList();
    for (AFreeplaneAction openMapAction : openMapActions) {
        modeController.addActionIfNotAlreadySet(openMapAction);
        new EntryAccessor().addChildAction(target, openMapAction);
    }
}
Also used : AFreeplaneAction(org.freeplane.core.ui.AFreeplaneAction) EntryAccessor(org.freeplane.core.ui.menubuilders.generic.EntryAccessor)

Example 18 with EntryAccessor

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

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

Example 20 with EntryAccessor

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

Aggregations

EntryAccessor (org.freeplane.core.ui.menubuilders.generic.EntryAccessor)58 Entry (org.freeplane.core.ui.menubuilders.generic.Entry)40 Test (org.junit.Test)35 AFreeplaneAction (org.freeplane.core.ui.AFreeplaneAction)27 JMenu (javax.swing.JMenu)13 Component (java.awt.Component)6 Container (java.awt.Container)6 JMenuItem (javax.swing.JMenuItem)6 JToolBar (javax.swing.JToolBar)4 JButton (javax.swing.JButton)3 JComponent (javax.swing.JComponent)3 JPanel (javax.swing.JPanel)3 FreeplaneMenuBar (org.freeplane.core.ui.components.FreeplaneMenuBar)3 FreeplaneToolBar (org.freeplane.core.ui.components.FreeplaneToolBar)3 FreeplaneResourceAccessor (org.freeplane.core.ui.menubuilders.FreeplaneResourceAccessor)3 JToolbarComponentBuilder (org.freeplane.core.ui.menubuilders.menu.JToolbarComponentBuilder)3 ActionEvent (java.awt.event.ActionEvent)2 KeyStroke (javax.swing.KeyStroke)2 ResourceController (org.freeplane.core.resources.ResourceController)2 ActionEnabler (org.freeplane.core.ui.ActionEnabler)2