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