Search in sources :

Example 86 with JToolBar

use of javax.swing.JToolBar 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 JComboBoxWithBorder(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 JAutoToggleButton applyQuickFilterBtn = new JAutoToggleButton(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) 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) ViewController(org.freeplane.features.ui.ViewController) HighlightController(org.freeplane.features.highlight.HighlightController) FrameController(org.freeplane.features.ui.FrameController) JComboBoxWithBorder(org.freeplane.core.ui.components.JComboBoxWithBorder) FrameController(org.freeplane.features.ui.FrameController)

Example 87 with JToolBar

use of javax.swing.JToolBar in project freeplane by freeplane.

the class MenuBuilderIntegrationTest method setup.

@Before
public void setup() {
    freeplaneActions = mock(FreeplaneActions.class);
    recursiveMenuStructureBuilder = new RecursiveMenuStructureProcessor();
    recursiveMenuStructureBuilder.setDefaultBuilderPair(EntryVisitor.EMTPY, EntryVisitor.EMTPY);
    final IUserInputListenerFactory userInputListenerFactory = mock(IUserInputListenerFactory.class);
    toolbar = new JToolBar();
    when(userInputListenerFactory.getToolBar("/main_toolbar")).thenReturn(toolbar);
    recursiveMenuStructureBuilder.addBuilder("toolbar", new JToolbarBuilder(userInputListenerFactory));
    recursiveMenuStructureBuilder.setSubtreeDefaultBuilderPair("toolbar", "toolbar.action");
    recursiveMenuStructureBuilder.addBuilderPair("toolbar.action", new BuilderDestroyerPair(new JToolbarComponentBuilder(), null));
}
Also used : RecursiveMenuStructureProcessor(org.freeplane.core.ui.menubuilders.generic.RecursiveMenuStructureProcessor) FreeplaneActions(org.freeplane.features.mode.FreeplaneActions) IUserInputListenerFactory(org.freeplane.core.ui.IUserInputListenerFactory) BuilderDestroyerPair(org.freeplane.core.ui.menubuilders.generic.BuilderDestroyerPair) JToolbarBuilder(org.freeplane.core.ui.menubuilders.menu.JToolbarBuilder) JToolbarComponentBuilder(org.freeplane.core.ui.menubuilders.menu.JToolbarComponentBuilder) JToolBar(javax.swing.JToolBar) Before(org.junit.Before)

Example 88 with JToolBar

use of javax.swing.JToolBar in project freeplane by freeplane.

the class MenuBuilderIntegrationTest method givengroupWithAction_addsActionButtonToToolbar.

@Test
public void givengroupWithAction_addsActionButtonToToolbar() {
    String content = "<FreeplaneUIEntries>" + "<Entry name='home' builder='toolbar'>" + "<Entry name='action'/>" + "</Entry>" + "</FreeplaneUIEntries>";
    final AFreeplaneAction someAction = Mockito.mock(AFreeplaneAction.class);
    when(freeplaneActions.getAction("action")).thenReturn(someAction);
    Entry builtMenuStructure = buildJMenu(content);
    final JToolBar toolbar = (JToolBar) new EntryAccessor().getComponent(builtMenuStructure.getChild(0));
    final JButton button = (JButton) new EntryAccessor().getComponent(builtMenuStructure.getChild(0).getChild(0));
    assertThat(button.getParent(), CoreMatchers.equalTo((Container) toolbar));
}
Also used : AFreeplaneAction(org.freeplane.core.ui.AFreeplaneAction) Entry(org.freeplane.core.ui.menubuilders.generic.Entry) Container(java.awt.Container) EntryAccessor(org.freeplane.core.ui.menubuilders.generic.EntryAccessor) JButton(javax.swing.JButton) JToolBar(javax.swing.JToolBar) Test(org.junit.Test)

Example 89 with JToolBar

use of javax.swing.JToolBar in project freeplane by freeplane.

the class JToolbarBuilderTest method createsEmptyToolbarComponent.

@Test
public void createsEmptyToolbarComponent() {
    Entry toolbarEntry = new Entry();
    final IUserInputListenerFactory userInputListenerFactory = mock(IUserInputListenerFactory.class);
    JToolBar toolbar = new JToolBar();
    when(userInputListenerFactory.getToolBar("/main_toolbar")).thenReturn(toolbar);
    final JToolbarBuilder toolbarBuilder = new JToolbarBuilder(userInputListenerFactory);
    toolbarBuilder.visit(toolbarEntry);
    assertThat(new EntryAccessor().getComponent(toolbarEntry), CoreMatchers.<Object>is(toolbar));
}
Also used : Entry(org.freeplane.core.ui.menubuilders.generic.Entry) IUserInputListenerFactory(org.freeplane.core.ui.IUserInputListenerFactory) EntryAccessor(org.freeplane.core.ui.menubuilders.generic.EntryAccessor) JToolBar(javax.swing.JToolBar) Test(org.junit.Test)

Example 90 with JToolBar

use of javax.swing.JToolBar in project lotro-companion by dmorcellet.

the class StashWindowController method buildTablePanel.

private JPanel buildTablePanel() {
    JPanel ret = GuiFactory.buildBackgroundPanel(new BorderLayout());
    _toolbar = buildToolBar();
    JToolBar toolbar = _toolbar.getToolBar();
    ret.add(toolbar, BorderLayout.NORTH);
    _itemsTable = buildTable();
    JTable table = _itemsTable.getTable();
    JScrollPane scroll = GuiFactory.buildScrollPane(table);
    ret.add(scroll, BorderLayout.CENTER);
    return ret;
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) JTable(javax.swing.JTable) JToolBar(javax.swing.JToolBar)

Aggregations

JToolBar (javax.swing.JToolBar)124 JButton (javax.swing.JButton)51 BorderLayout (java.awt.BorderLayout)45 JPanel (javax.swing.JPanel)37 JScrollPane (javax.swing.JScrollPane)30 Dimension (java.awt.Dimension)25 Insets (java.awt.Insets)25 ActionEvent (java.awt.event.ActionEvent)24 JLabel (javax.swing.JLabel)23 ActionListener (java.awt.event.ActionListener)19 ImageIcon (javax.swing.ImageIcon)17 Component (java.awt.Component)14 JSplitPane (javax.swing.JSplitPane)14 JTable (javax.swing.JTable)14 JTextField (javax.swing.JTextField)14 JPopupMenu (javax.swing.JPopupMenu)13 JToggleButton (javax.swing.JToggleButton)12 GridBagConstraints (java.awt.GridBagConstraints)10 GridBagLayout (java.awt.GridBagLayout)10 JComponent (javax.swing.JComponent)10