@Test public void testInit() throws Exception { RepositoryExtended repository = Mockito.mock( RepositoryExtended.class ); UserInfo userInfo = new UserInfo( "user", "password", "user", "test user", true ); userInfo.setAdmin( true ); Mockito.doReturn( userInfo ).when( repository ).getUserInfo(); Mockito.doReturn( Mockito.mock( RepositoryDirectoryInterface.class ) ).when( repository ). loadRepositoryDirectoryTree( anyString(), anyString(), anyInt(), anyBoolean(), anyBoolean(), anyBoolean() ); BrowseController browseController = Mockito.spy( controller ); doNothing().when( browseController ).createBindings(); browseController.init( repository ); Mockito.verify( repository ).loadRepositoryDirectoryTree( "/", "*.ktr|*.kjb", -1, true, true, true ); userInfo.setAdmin( false ); browseController.init( repository ); Mockito.verify( repository ).loadRepositoryDirectoryTree( "/", "*.ktr|*.kjb", -1, false, true, true ); userInfo.setAdmin( null ); browseController.init( repository ); Mockito.verify( repository, Mockito.times( 2 ) ).loadRepositoryDirectoryTree( "/", "*.ktr|*.kjb", -1, false, true, true ); }
@SuppressWarnings( "deprecation" ) public void init( Repository repository ) throws ControllerInitializationException { try { this.repository = repository; mainController = (MainController) this.getXulDomContainer().getEventHandler( "mainController" ); RepositoryDirectoryInterface root; try { if ( repository instanceof RepositoryExtended ) { root = ( (RepositoryExtended) repository ).loadRepositoryDirectoryTree( "/", "*.ktr|*.kjb", -1, BooleanUtils.isTrue( repository.getUserInfo().isAdmin() ), true, true ); } else { root = repository.loadRepositoryDirectoryTree(); } this.repositoryDirectory = UIObjectRegistry.getInstance().constructUIRepositoryDirectory( root, null, repository ); } catch ( UIObjectCreationException uoe ) { this.repositoryDirectory = new UIRepositoryDirectory( repository.loadRepositoryDirectoryTree(), null, repository ); } dirMap = new HashMap<ObjectId, UIRepositoryDirectory>(); populateDirMap( repositoryDirectory ); bf = new SwtBindingFactory(); bf.setDocument( this.getXulDomContainer().getDocumentRoot() ); messageBox = (XulMessageBox) document.createElement( "messagebox" ); createBindings(); } catch ( Exception e ) { throw new ControllerInitializationException( e ); } }
BrowseController extends AbstractXulEventHandler implements IUISupportController, IBrowseController { @SuppressWarnings( "deprecation" ) public void init( Repository repository ) throws ControllerInitializationException { try { this.repository = repository; mainController = (MainController) this.getXulDomContainer().getEventHandler( "mainController" ); RepositoryDirectoryInterface root; try { if ( repository instanceof RepositoryExtended ) { root = ( (RepositoryExtended) repository ).loadRepositoryDirectoryTree( "/", "*.ktr|*.kjb", -1, BooleanUtils.isTrue( repository.getUserInfo().isAdmin() ), true, true ); } else { root = repository.loadRepositoryDirectoryTree(); } this.repositoryDirectory = UIObjectRegistry.getInstance().constructUIRepositoryDirectory( root, null, repository ); } catch ( UIObjectCreationException uoe ) { this.repositoryDirectory = new UIRepositoryDirectory( repository.loadRepositoryDirectoryTree(), null, repository ); } dirMap = new HashMap<ObjectId, UIRepositoryDirectory>(); populateDirMap( repositoryDirectory ); bf = new SwtBindingFactory(); bf.setDocument( this.getXulDomContainer().getDocumentRoot() ); messageBox = (XulMessageBox) document.createElement( "messagebox" ); createBindings(); } catch ( Exception e ) { throw new ControllerInitializationException( e ); } } }
BrowseController extends AbstractXulEventHandler implements IUISupportController, IBrowseController { @SuppressWarnings( "deprecation" ) public void init( Repository repository ) throws ControllerInitializationException { try { this.repository = repository; mainController = (MainController) this.getXulDomContainer().getEventHandler( "mainController" ); RepositoryDirectoryInterface root; try { if ( repository instanceof RepositoryExtended ) { root = ( (RepositoryExtended) repository ).loadRepositoryDirectoryTree( "/", "*.ktr|*.kjb", -1, BooleanUtils.isTrue( repository.getUserInfo().isAdmin() ), true, true ); } else { root = repository.loadRepositoryDirectoryTree(); } this.repositoryDirectory = UIObjectRegistry.getInstance().constructUIRepositoryDirectory( root, null, repository ); } catch ( UIObjectCreationException uoe ) { this.repositoryDirectory = new UIRepositoryDirectory( repository.loadRepositoryDirectoryTree(), null, repository ); } dirMap = new HashMap<ObjectId, UIRepositoryDirectory>(); populateDirMap( repositoryDirectory ); bf = new SwtBindingFactory(); bf.setDocument( this.getXulDomContainer().getDocumentRoot() ); messageBox = (XulMessageBox) document.createElement( "messagebox" ); createBindings(); } catch ( Exception e ) { throw new ControllerInitializationException( e ); } } BrowseController(); }
BrowseController extends AbstractXulEventHandler implements IUISupportController, IBrowseController { @SuppressWarnings( "deprecation" ) public void init( Repository repository ) throws ControllerInitializationException { try { this.repository = repository; mainController = (MainController) this.getXulDomContainer().getEventHandler( "mainController" ); RepositoryDirectoryInterface root; try { if ( repository instanceof RepositoryExtended ) { root = ( (RepositoryExtended) repository ).loadRepositoryDirectoryTree( "/", "*.ktr|*.kjb", -1, BooleanUtils.isTrue( repository.getUserInfo().isAdmin() ), true, true ); } else { root = repository.loadRepositoryDirectoryTree(); } this.repositoryDirectory = UIObjectRegistry.getInstance().constructUIRepositoryDirectory( root, null, repository ); } catch ( UIObjectCreationException uoe ) { this.repositoryDirectory = new UIRepositoryDirectory( repository.loadRepositoryDirectoryTree(), null, repository ); } dirMap = new HashMap<ObjectId, UIRepositoryDirectory>(); populateDirMap( repositoryDirectory ); bf = new SwtBindingFactory(); bf.setDocument( this.getXulDomContainer().getDocumentRoot() ); messageBox = (XulMessageBox) document.createElement( "messagebox" ); createBindings(); } catch ( Exception e ) { throw new ControllerInitializationException( e ); } } BrowseController(); @SuppressWarnings( "deprecation" ) void init( Repository repository ); String getName(); UIRepositoryDirectory getRepositoryDirectory(); void expandAllFolders(); void collapseAllFolders(); void openContent(); void openContent( Object[] items ); void renameContent(); void deleteContent(); void createFolder(); void exportFolder(); void deleteFolder(); void renameFolder(); void onDragFromGlobalTree( DropEvent event ); void onDragFromLocalTable( DropEvent event ); void onDrop( DropEvent event ); void onDoubleClick( Object[] selectedItems ); List<UIRepositoryDirectory> getSelectedFolderItems(); void setSelectedFolderItems( List<UIRepositoryDirectory> selectedFolderItems ); List<UIRepositoryObject> getSelectedFileItems(); void setSelectedFileItems( List<UIRepositoryObject> selectedFileItems ); Binding getSelectedItemsBinding(); void setSelectedItemsBinding( Binding selectedItemsBinding ); void setRepositoryObjects( List<UIRepositoryObject> selectedFileItems ); List<UIRepositoryObject> getRepositoryObjects(); void setRepositoryItems( List<UIRepositoryObject> selectedItems ); List<UIRepositoryObject> getRepositoryItems(); List<UIRepositoryDirectory> getRepositoryDirectories(); void setRepositoryDirectories( List<UIRepositoryDirectory> selectedFolderItems ); UIRepositoryObjects getSelectedRepoDirChildren(); void addContextChangeVetoer( ContextChangeVetoer listener ); void removeContextChangeVetoer( ContextChangeVetoer listener ); }
BrowseController extends AbstractXulEventHandler implements IUISupportController, IBrowseController { @SuppressWarnings( "deprecation" ) public void init( Repository repository ) throws ControllerInitializationException { try { this.repository = repository; mainController = (MainController) this.getXulDomContainer().getEventHandler( "mainController" ); RepositoryDirectoryInterface root; try { if ( repository instanceof RepositoryExtended ) { root = ( (RepositoryExtended) repository ).loadRepositoryDirectoryTree( "/", "*.ktr|*.kjb", -1, BooleanUtils.isTrue( repository.getUserInfo().isAdmin() ), true, true ); } else { root = repository.loadRepositoryDirectoryTree(); } this.repositoryDirectory = UIObjectRegistry.getInstance().constructUIRepositoryDirectory( root, null, repository ); } catch ( UIObjectCreationException uoe ) { this.repositoryDirectory = new UIRepositoryDirectory( repository.loadRepositoryDirectoryTree(), null, repository ); } dirMap = new HashMap<ObjectId, UIRepositoryDirectory>(); populateDirMap( repositoryDirectory ); bf = new SwtBindingFactory(); bf.setDocument( this.getXulDomContainer().getDocumentRoot() ); messageBox = (XulMessageBox) document.createElement( "messagebox" ); createBindings(); } catch ( Exception e ) { throw new ControllerInitializationException( e ); } } BrowseController(); @SuppressWarnings( "deprecation" ) void init( Repository repository ); String getName(); UIRepositoryDirectory getRepositoryDirectory(); void expandAllFolders(); void collapseAllFolders(); void openContent(); void openContent( Object[] items ); void renameContent(); void deleteContent(); void createFolder(); void exportFolder(); void deleteFolder(); void renameFolder(); void onDragFromGlobalTree( DropEvent event ); void onDragFromLocalTable( DropEvent event ); void onDrop( DropEvent event ); void onDoubleClick( Object[] selectedItems ); List<UIRepositoryDirectory> getSelectedFolderItems(); void setSelectedFolderItems( List<UIRepositoryDirectory> selectedFolderItems ); List<UIRepositoryObject> getSelectedFileItems(); void setSelectedFileItems( List<UIRepositoryObject> selectedFileItems ); Binding getSelectedItemsBinding(); void setSelectedItemsBinding( Binding selectedItemsBinding ); void setRepositoryObjects( List<UIRepositoryObject> selectedFileItems ); List<UIRepositoryObject> getRepositoryObjects(); void setRepositoryItems( List<UIRepositoryObject> selectedItems ); List<UIRepositoryObject> getRepositoryItems(); List<UIRepositoryDirectory> getRepositoryDirectories(); void setRepositoryDirectories( List<UIRepositoryDirectory> selectedFolderItems ); UIRepositoryObjects getSelectedRepoDirChildren(); void addContextChangeVetoer( ContextChangeVetoer listener ); void removeContextChangeVetoer( ContextChangeVetoer listener );  }