@Test public void testGetRowCount() { RepositoryTableModel repoTableModel = new RepositoryTableModel(); assertNotNull( repoTableModel ); assertEquals( 0, repoTableModel.getRowCount() ); repoTableModel.setSelectedPath( fileObject ); assertEquals( 0, repoTableModel.getRowCount() ); try { doReturn( FileType.FOLDER ).when( fileObject ).getType(); FileObject[] childFiles = new FileObject[] { childFile1, childFile2, childFile3 }; doReturn( childFileName1 ).when( childFile1 ).getName(); doReturn( childFileName2 ).when( childFile2 ).getName(); doReturn( childFileName3 ).when( childFile3 ).getName(); doReturn( "file1.txt" ).when( childFileName1 ).getBaseName(); doReturn( "file2.txt" ).when( childFileName2 ).getBaseName(); doReturn( "file3.txt" ).when( childFileName3 ).getBaseName(); doReturn( childFiles ).when( fileObject ).getChildren(); assertEquals( 3, repoTableModel.getRowCount() ); } catch ( FileSystemException e ) { e.printStackTrace(); } }
public int getRowCount() { if ( selectedPath == null ) { return 0; } try { if ( selectedPath.getType() != FileType.FOLDER ) { return 0; } final FileObject[] children = selectedPath.getChildren(); int count = 0; for ( int i = 0; i < children.length; i++ ) { final FileObject child = children[i]; if ( isShowHiddenFiles() == false && child.isHidden() ) { continue; } if ( child.getType() != FileType.FOLDER ) { if ( PublishUtil.acceptFilter( filters, child.getName().getBaseName() ) == false ) { continue; } } count += 1; } return count; } catch ( FileSystemException fse ) { UncaughtExceptionsModel.getInstance().addException( fse ); return 0; } }
RepositoryTableModel extends AbstractTableModel { public int getRowCount() { if ( selectedPath == null ) { return 0; } try { if ( selectedPath.getType() != FileType.FOLDER ) { return 0; } final FileObject[] children = selectedPath.getChildren(); int count = 0; for ( int i = 0; i < children.length; i++ ) { final FileObject child = children[i]; if ( isShowHiddenFiles() == false && child.isHidden() ) { continue; } if ( child.getType() != FileType.FOLDER ) { if ( PublishUtil.acceptFilter( filters, child.getName().getBaseName() ) == false ) { continue; } } count += 1; } return count; } catch ( FileSystemException fse ) { UncaughtExceptionsModel.getInstance().addException( fse ); return 0; } } }
RepositoryTableModel extends AbstractTableModel { public int getRowCount() { if ( selectedPath == null ) { return 0; } try { if ( selectedPath.getType() != FileType.FOLDER ) { return 0; } final FileObject[] children = selectedPath.getChildren(); int count = 0; for ( int i = 0; i < children.length; i++ ) { final FileObject child = children[i]; if ( isShowHiddenFiles() == false && child.isHidden() ) { continue; } if ( child.getType() != FileType.FOLDER ) { if ( PublishUtil.acceptFilter( filters, child.getName().getBaseName() ) == false ) { continue; } } count += 1; } return count; } catch ( FileSystemException fse ) { UncaughtExceptionsModel.getInstance().addException( fse ); return 0; } } RepositoryTableModel(); }
RepositoryTableModel extends AbstractTableModel { public int getRowCount() { if ( selectedPath == null ) { return 0; } try { if ( selectedPath.getType() != FileType.FOLDER ) { return 0; } final FileObject[] children = selectedPath.getChildren(); int count = 0; for ( int i = 0; i < children.length; i++ ) { final FileObject child = children[i]; if ( isShowHiddenFiles() == false && child.isHidden() ) { continue; } if ( child.getType() != FileType.FOLDER ) { if ( PublishUtil.acceptFilter( filters, child.getName().getBaseName() ) == false ) { continue; } } count += 1; } return count; } catch ( FileSystemException fse ) { UncaughtExceptionsModel.getInstance().addException( fse ); return 0; } } RepositoryTableModel(); boolean isShowHiddenFiles(); void setShowHiddenFiles( final boolean showHiddenFiles ); String[] getFilters(); void setFilters( final String[] filters ); FileObject getSelectedPath(); void setSelectedPath( final FileObject selectedPath ); int getColumnCount(); int getRowCount(); String getColumnName( final int col ); FileObject getElementForRow( final int row ); Object getValueAt( final int row, final int column ); Class getColumnClass( final int column ); }
RepositoryTableModel extends AbstractTableModel { public int getRowCount() { if ( selectedPath == null ) { return 0; } try { if ( selectedPath.getType() != FileType.FOLDER ) { return 0; } final FileObject[] children = selectedPath.getChildren(); int count = 0; for ( int i = 0; i < children.length; i++ ) { final FileObject child = children[i]; if ( isShowHiddenFiles() == false && child.isHidden() ) { continue; } if ( child.getType() != FileType.FOLDER ) { if ( PublishUtil.acceptFilter( filters, child.getName().getBaseName() ) == false ) { continue; } } count += 1; } return count; } catch ( FileSystemException fse ) { UncaughtExceptionsModel.getInstance().addException( fse ); return 0; } } RepositoryTableModel(); boolean isShowHiddenFiles(); void setShowHiddenFiles( final boolean showHiddenFiles ); String[] getFilters(); void setFilters( final String[] filters ); FileObject getSelectedPath(); void setSelectedPath( final FileObject selectedPath ); int getColumnCount(); int getRowCount(); String getColumnName( final int col ); FileObject getElementForRow( final int row ); Object getValueAt( final int row, final int column ); Class getColumnClass( final int column );  }