Search in sources :

Example 6 with FreeplaneToolBar

use of org.freeplane.core.ui.components.FreeplaneToolBar in project freeplane by freeplane.

the class JToolbarComponentBuilderTest method createsToolbarButtonWithSelectableAction.

@Test
public void createsToolbarButtonWithSelectableAction() {
    Entry actionEntry = new Entry();
    final AFreeplaneAction action = Mockito.mock(AFreeplaneAction.class);
    when(action.isSelectable()).thenReturn(true);
    new EntryAccessor().setAction(actionEntry, action);
    Entry toolbarEntry = new Entry();
    final FreeplaneToolBar toolbar = new FreeplaneToolBar("toolbar", SwingConstants.HORIZONTAL);
    new EntryAccessor().setComponent(toolbarEntry, toolbar);
    toolbarEntry.addChild(actionEntry);
    final JToolbarComponentBuilder toolbarActionGroupBuilder = new JToolbarComponentBuilder();
    toolbarActionGroupBuilder.visit(actionEntry);
    JAutoToggleButton button = (JAutoToggleButton) new EntryAccessor().getComponent(actionEntry);
    assertThat(button.getAction(), CoreMatchers.<Action>equalTo(action));
    assertThat(button.getParent(), CoreMatchers.equalTo((Container) toolbar));
}
Also used : JAutoToggleButton(org.freeplane.core.ui.components.JAutoToggleButton) Entry(org.freeplane.core.ui.menubuilders.generic.Entry) AFreeplaneAction(org.freeplane.core.ui.AFreeplaneAction) Container(java.awt.Container) EntryAccessor(org.freeplane.core.ui.menubuilders.generic.EntryAccessor) FreeplaneToolBar(org.freeplane.core.ui.components.FreeplaneToolBar) JToolbarComponentBuilder(org.freeplane.core.ui.menubuilders.menu.JToolbarComponentBuilder) Test(org.junit.Test)

Example 7 with FreeplaneToolBar

use of org.freeplane.core.ui.components.FreeplaneToolBar in project freeplane by freeplane.

the class JToolbarComponentBuilderTest method createsVerticalToolbarSeparator.

@Test
public void createsVerticalToolbarSeparator() {
    Entry separatorEntry = new Entry();
    separatorEntry.setBuilders(asList("separator"));
    Entry toolbarEntry = new Entry();
    final FreeplaneToolBar toolbar = new FreeplaneToolBar("toolbar", SwingConstants.HORIZONTAL);
    new EntryAccessor().setComponent(toolbarEntry, toolbar);
    toolbarEntry.addChild(separatorEntry);
    final JToolbarComponentBuilder toolbarActionGroupBuilder = new JToolbarComponentBuilder();
    toolbarActionGroupBuilder.visit(separatorEntry);
    JToolBar.Separator separator = (JToolBar.Separator) new EntryAccessor().getComponent(separatorEntry);
    assertThat(separator.getParent(), CoreMatchers.equalTo((Container) toolbar));
    assertThat(separator.getOrientation(), CoreMatchers.equalTo(SwingConstants.VERTICAL));
}
Also used : Entry(org.freeplane.core.ui.menubuilders.generic.Entry) Container(java.awt.Container) EntryAccessor(org.freeplane.core.ui.menubuilders.generic.EntryAccessor) FreeplaneToolBar(org.freeplane.core.ui.components.FreeplaneToolBar) JToolbarComponentBuilder(org.freeplane.core.ui.menubuilders.menu.JToolbarComponentBuilder) JToolBar(javax.swing.JToolBar) Test(org.junit.Test)

Example 8 with FreeplaneToolBar

use of org.freeplane.core.ui.components.FreeplaneToolBar in project freeplane by freeplane.

the class BModeControllerFactory method createModeController.

public static BModeController createModeController() {
    final Controller controller = Controller.getCurrentController();
    modeController = new BModeController(controller);
    final UserInputListenerFactory userInputListenerFactory = new UserInputListenerFactory(modeController, false);
    modeController.setUserInputListenerFactory(userInputListenerFactory);
    controller.addModeController(modeController);
    controller.selectModeForBuild(modeController);
    new MapController(modeController);
    IconController.install(new IconController(modeController));
    UrlManager.install(new UrlManager());
    MapIO.install(modeController);
    AttributeController.install(new AttributeController(modeController));
    NodeStyleController.install(new NodeStyleController(modeController));
    EdgeController.install(new EdgeController(modeController));
    CloudController.install(new CloudController(modeController));
    NoteController.install(new NoteController());
    TextController.install(new TextController(modeController));
    LinkController.install(new LinkController());
    LogicalStyleController.install(new LogicalStyleController(modeController));
    try {
        ClipboardController.install(new ClipboardController());
    } catch (final AccessControlException e) {
        LogUtils.warn("can not access system clipboard, clipboard controller disabled");
    }
    LocationController.install(new LocationController());
    SummaryNode.install();
    FreeNode.install();
    MapStyle.install(true);
    final BToolbarContributor toolbarContributor = new BToolbarContributor();
    modeController.addMenuContributor(toolbarContributor);
    controller.getMapViewManager().addMapViewChangeListener(toolbarContributor);
    userInputListenerFactory.setNodePopupMenu(new JPopupMenu());
    final FreeplaneToolBar toolBar = new FreeplaneToolBar("main_toolbar", SwingConstants.HORIZONTAL);
    FrameController frameController = (FrameController) controller.getViewController();
    UIComponentVisibilityDispatcher.install(frameController, toolBar, "toolbarVisible");
    userInputListenerFactory.addToolBar("/main_toolbar", ViewController.TOP, toolBar);
    userInputListenerFactory.addToolBar("/filter_toolbar", ViewController.BOTTOM, FilterController.getController(controller).getFilterToolbar());
    userInputListenerFactory.addToolBar("/status", ViewController.BOTTOM, controller.getViewController().getStatusBar());
    FoldingController.install(new FoldingController());
    new ViewerController();
    EncryptionController.install(new EncryptionController(modeController));
    new AutomaticLayoutController();
    new CloneStateIconSupplier().registerStateIconProvider();
    return modeController;
}
Also used : UrlManager(org.freeplane.features.url.UrlManager) ClipboardController(org.freeplane.features.clipboard.ClipboardController) AutomaticLayoutController(org.freeplane.features.styles.AutomaticLayoutController) BModeController(org.freeplane.features.mode.browsemode.BModeController) LinkController(org.freeplane.features.link.LinkController) LocationController(org.freeplane.features.nodelocation.LocationController) ViewerController(org.freeplane.view.swing.features.filepreview.ViewerController) IconController(org.freeplane.features.icon.IconController) FoldingController(org.freeplane.features.map.FoldingController) FrameController(org.freeplane.features.ui.FrameController) CloneStateIconSupplier(org.freeplane.features.map.CloneStateIconSupplier) NoteController(org.freeplane.features.note.NoteController) EdgeController(org.freeplane.features.edge.EdgeController) AttributeController(org.freeplane.features.attribute.AttributeController) TextController(org.freeplane.features.text.TextController) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) UserInputListenerFactory(org.freeplane.view.swing.ui.UserInputListenerFactory) AccessControlException(java.security.AccessControlException) AttributeController(org.freeplane.features.attribute.AttributeController) EncryptionController(org.freeplane.features.encrypt.EncryptionController) ViewerController(org.freeplane.view.swing.features.filepreview.ViewerController) ClipboardController(org.freeplane.features.clipboard.ClipboardController) BModeController(org.freeplane.features.mode.browsemode.BModeController) NoteController(org.freeplane.features.note.NoteController) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) EdgeController(org.freeplane.features.edge.EdgeController) ViewController(org.freeplane.features.ui.ViewController) CloudController(org.freeplane.features.cloud.CloudController) LinkController(org.freeplane.features.link.LinkController) FilterController(org.freeplane.features.filter.FilterController) MapController(org.freeplane.features.map.MapController) LocationController(org.freeplane.features.nodelocation.LocationController) FoldingController(org.freeplane.features.map.FoldingController) FrameController(org.freeplane.features.ui.FrameController) IconController(org.freeplane.features.icon.IconController) Controller(org.freeplane.features.mode.Controller) TextController(org.freeplane.features.text.TextController) AutomaticLayoutController(org.freeplane.features.styles.AutomaticLayoutController) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController) JPopupMenu(javax.swing.JPopupMenu) MapController(org.freeplane.features.map.MapController) EncryptionController(org.freeplane.features.encrypt.EncryptionController) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController) CloudController(org.freeplane.features.cloud.CloudController) FreeplaneToolBar(org.freeplane.core.ui.components.FreeplaneToolBar)

Example 9 with FreeplaneToolBar

use of org.freeplane.core.ui.components.FreeplaneToolBar in project freeplane by freeplane.

the class FilterController method createFilterToolbar.

private JToolBar createFilterToolbar() {
    final JToolBar filterToolbar = new FreeplaneToolBar("filter_toolbar", SwingConstants.HORIZONTAL);
    filterToolbar.setVisible(ResourceController.getResourceController().getBooleanProperty("filter_toolbar_visible"));
    Controller controller = Controller.getCurrentController();
    FrameController frameController = (FrameController) controller.getViewController();
    UIComponentVisibilityDispatcher.install(frameController, filterToolbar, "filter_toolbar_visible");
    final JButton undoBtn = new JButton(controller.getAction("UndoFilterAction"));
    final JButton redoBtn = new JButton(controller.getAction("RedoFilterAction"));
    final JToggleButton showAncestorsBox = new JAutoToggleButton(controller.getAction("ShowAncestorsAction"), showAncestors);
    showAncestorsBox.setSelected(showAncestors.isSelected());
    final JToggleButton showDescendantsBox = new JAutoToggleButton(controller.getAction("ShowDescendantsAction"), showDescendants);
    final JToggleButton applyToVisibleBox = new JAutoToggleButton(controller.getAction("ApplyToVisibleAction"), applyToVisibleNodeOnly);
    final JButton btnEdit = new JButton(controller.getAction("EditFilterAction"));
    activeFilterConditionComboBox = new JComboBox(getFilterConditions());
    final JButton applyBtn = new JButton(controller.getAction("ReapplyFilterAction"));
    final JButton filterSelectedBtn = new JButton(controller.getAction("ApplySelectedViewConditionAction"));
    final JButton noFilteringBtn = new JButton(controller.getAction("ApplyNoFilteringAction"));
    final JButton applyFindPreviousBtn = new JButton(controller.getAction("QuickFindAction.BACK"));
    final JButton applyFindNextBtn = new JButton(controller.getAction("QuickFindAction.FORWARD"));
    final JButton applyQuickFilterBtn = new JButton(controller.getAction("QuickFilterAction"));
    final JButton applyQuickSelectBtn = new JButton(controller.getAction("QuickFindAllAction"));
    final JToggleButton applyQuickHighlightBtn = new JAutoToggleButton(controller.getAction("QuickHighlightAction"));
    filterToolbar.addSeparator();
    filterToolbar.add(undoBtn);
    filterToolbar.add(redoBtn);
    filterToolbar.add(showAncestorsBox);
    filterToolbar.add(showDescendantsBox);
    filterToolbar.add(applyToVisibleBox);
    filterToolbar.add(activeFilterConditionComboBox);
    filterToolbar.add(applyBtn);
    filterToolbar.add(filterSelectedBtn);
    filterToolbar.add(noFilteringBtn);
    filterToolbar.add(btnEdit);
    filterToolbar.addSeparator();
    filterToolbar.add(quickEditor);
    filterToolbar.add(applyFindPreviousBtn);
    filterToolbar.add(applyFindNextBtn);
    filterToolbar.add(applyQuickSelectBtn);
    filterToolbar.add(applyQuickFilterBtn);
    filterToolbar.add(applyQuickHighlightBtn);
    final DefaultConditionRenderer toolbarConditionRenderer = new DefaultConditionRenderer(TextUtils.getText("filter_no_filtering"), false);
    activeFilterConditionComboBox.setRenderer(toolbarConditionRenderer);
    return filterToolbar;
}
Also used : JAutoToggleButton(org.freeplane.core.ui.components.JAutoToggleButton) DefaultConditionRenderer(org.freeplane.features.filter.condition.DefaultConditionRenderer) JToggleButton(javax.swing.JToggleButton) JComboBox(javax.swing.JComboBox) FreeplaneToolBar(org.freeplane.core.ui.components.FreeplaneToolBar) JButton(javax.swing.JButton) JToolBar(javax.swing.JToolBar) Controller(org.freeplane.features.mode.Controller) ResourceController(org.freeplane.core.resources.ResourceController) FrameController(org.freeplane.features.ui.FrameController) ModeController(org.freeplane.features.mode.ModeController) FrameController(org.freeplane.features.ui.FrameController)

Aggregations

FreeplaneToolBar (org.freeplane.core.ui.components.FreeplaneToolBar)9 Controller (org.freeplane.features.mode.Controller)6 JPopupMenu (javax.swing.JPopupMenu)5 CloudController (org.freeplane.features.cloud.CloudController)5 EdgeController (org.freeplane.features.edge.EdgeController)5 FilterController (org.freeplane.features.filter.FilterController)5 IconController (org.freeplane.features.icon.IconController)5 LinkController (org.freeplane.features.link.LinkController)5 NodeStyleController (org.freeplane.features.nodestyle.NodeStyleController)5 LogicalStyleController (org.freeplane.features.styles.LogicalStyleController)5 TextController (org.freeplane.features.text.TextController)5 FrameController (org.freeplane.features.ui.FrameController)5 ViewController (org.freeplane.features.ui.ViewController)5 UserInputListenerFactory (org.freeplane.view.swing.ui.UserInputListenerFactory)5 AttributeController (org.freeplane.features.attribute.AttributeController)4 ClipboardController (org.freeplane.features.clipboard.ClipboardController)4 MapController (org.freeplane.features.map.MapController)4 LocationController (org.freeplane.features.nodelocation.LocationController)4 NoteController (org.freeplane.features.note.NoteController)4 Container (java.awt.Container)3