use of org.freeplane.core.ui.menubuilders.generic.Entry in project freeplane by freeplane.
the class UserInputListenerFactory method filterPlugins.
private void filterPlugins(Entry entry, Set<String> plugins) {
final Iterator<Entry> iterator = entry.children().iterator();
while (iterator.hasNext()) {
final Entry child = iterator.next();
final Object plugin = child.getAttribute("plugin");
if (plugin != null && !plugins.contains(plugin))
iterator.remove();
else
filterPlugins(child, plugins);
}
}
use of org.freeplane.core.ui.menubuilders.generic.Entry in project freeplane by freeplane.
the class UserInputListenerFactory method createModeActions.
private void createModeActions(final Entry modesMenuEntry) {
rebuildMenuOnMapChange(modesMenuEntry);
Controller controller = Controller.getCurrentController();
EntryAccessor entryAccessor = new EntryAccessor();
for (final String key : new LinkedList<String>(controller.getModes())) {
final AFreeplaneAction modesMenuAction = new ModesMenuAction(key, controller);
modeController.addActionIfNotAlreadySet(modesMenuAction);
Entry actionEntry = new Entry();
entryAccessor.setAction(actionEntry, modesMenuAction);
actionEntry.setName(modesMenuAction.getKey());
final ModeController modeController = controller.getModeController();
if (modeController != null && modeController.getModeName().equals(key)) {
actionEntry.setAttribute("selected", true);
}
modesMenuEntry.addChild(actionEntry);
ResourceController.getResourceController().getProperty(("keystroke_mode_" + key));
}
}
use of org.freeplane.core.ui.menubuilders.generic.Entry in project freeplane by freeplane.
the class JComponentRemoverTest method removesComponentsFromParents.
@Test
public void removesComponentsFromParents() throws Exception {
final JComponentRemover componentRemover = new JComponentRemover();
final Entry entry = new Entry();
JComponent parent = new JPanel();
JComponent entryComponent = new JPanel();
parent.add(entryComponent);
new EntryAccessor().setComponent(entry, entryComponent);
componentRemover.visit(entry);
Assert.assertThat(entryComponent.getParent(), nullValue(Container.class));
}
use of org.freeplane.core.ui.menubuilders.generic.Entry in project freeplane by freeplane.
the class JComponentRemoverTest method removesExtraSubmenusFromParents.
@Test
public void removesExtraSubmenusFromParents() throws Exception {
final JComponentRemover componentRemover = new JComponentRemover();
final Entry entry = new Entry();
JMenu parent = new JMenu();
JComponent entryComponent = new JMenu();
final MenuSplitter menuSplitter = new MenuSplitter(1);
menuSplitter.addMenuComponent(parent, new JMenu());
menuSplitter.addMenuComponent(parent, entryComponent);
new EntryAccessor().setComponent(entry, entryComponent);
componentRemover.visit(entry);
Assert.assertThat(parent.getPopupMenu().getComponentCount(), equalTo(1));
}
use of org.freeplane.core.ui.menubuilders.generic.Entry in project freeplane by freeplane.
the class JComponentRemoverTest method ignoresEntriesWithoutComponents.
@Test
public void ignoresEntriesWithoutComponents() throws Exception {
final JComponentRemover componentRemover = new JComponentRemover();
final Entry entry = new Entry();
componentRemover.visit(entry);
}
Aggregations