@Override public boolean error( Object o, Throwable throwable ) { if ( options.isEmpty() ) { addDefaultOptions(); } configCommand.execute(); return false; } };
@Override public void callback( Set<Option> optionsResult ) { if ( optionsResult != null && !optionsResult.isEmpty() ) { options.clear(); options.addAll( optionsResult ); } else if ( options.isEmpty() ) { addDefaultOptions(); } configCommand.execute(); } };
public void init( final PlaceRequest placeRequest, final Command completeCommand ) { this.placeRequest = placeRequest; Set<Option> optionsFromModeParameter = getOptionsFromModeParameter( placeRequest.getParameter( "mode", "" ) ); if ( optionsFromModeParameter.isEmpty() ) { options.addAll( getOptionsFromModeParameter( getWindowParameter( "explorer_mode" ) ) ); } else { options.addAll( optionsFromModeParameter ); } if ( options.isEmpty() ) { load( completeCommand ); } else { completeCommand.execute(); } }
@Test public void testParametersInPlaceRequest_business_tree() throws Exception { Command completeCommand = mock( Command.class ); PlaceRequest placeRequest = mock( PlaceRequest.class ); when( placeRequest.getParameter( "mode", "" ) ).thenReturn( "business_tree" ); options.init( placeRequest, completeCommand ); assertFalse( options.getOptions().isEmpty() ); assertTrue( options.isBusinessViewActive() ); assertTrue( options.isTreeNavigatorVisible() ); assertFalse( options.areHiddenFilesVisible() ); verify( completeCommand ).execute(); } }
@Test public void testNoParameters() throws Exception { Command completeCommand = mock( Command.class ); options.init( mock( PlaceRequest.class ), completeCommand ); assertFalse( options.getOptions().isEmpty() ); assertTrue( options.isBusinessViewActive() ); assertTrue( options.isBreadCrumbNavigationVisible() ); assertFalse( options.areHiddenFilesVisible() ); verify( completeCommand ).execute(); }
pkg); if (options != null && !options.isEmpty()) { lastContent.setOptions(options);