@ -66,6 +66,7 @@ class AppController extends Logging {
// configure the listener
guiListener ! SetupListener ( progressBar , progressLabel )
// tell the engine to use our listener
this . engine . setSearchedListener ( guiListener )
this . engine . setProcessedListener ( guiListener )
this . engine . setSimilarityListener ( guiListener )
// Initialize the progress label
@ -282,44 +283,12 @@ class AppController extends Logging {
}
}
@FXML
def showSimilarImages ( event : ActionEvent ) = {
resetPaginator ( )
imageTilePane . getChildren . setAll ( new java . util . ArrayList [ Node ] ( ) )
val f : Future [ List [ Image ] ] = Future {
val similarImages = engine . getSimilarImagesForDirectory ( currentDirectory , recursive = doRecursiveProcessing . isSelected )
val tempImages = new mutable . MutableList [ Image ] ( )
for ( similarImage <- similarImages ) {
debug ( s" Adding similar images ${ similarImage . rootImage . toString } to app " )
tempImages += similarImage . rootImage
similarImage . similarImages . foreach ( image => tempImages += image )
}
tempImages . toList
}
f onComplete {
case Success ( images ) =>
info ( s" Displaying ${ images . length } similar images " )
Platform . runLater ( new Runnable ( ) {
override def run ( ) {
setPagesContent ( images )
showPage ( 0 )
}
} )
case Failure ( t ) =>
error ( "An Error Occurred" , t )
}
}
// endregion
def resetPaginator ( ) = {
this . paginator . setDisable ( true )
this . paginator . setPageCount ( 1 )
}
// todo : include a templating engine for rendering informat ion
// endregion
def setPagesContent ( images : List [ Image ] ) = {
this . currentImages = images
@ -330,6 +299,8 @@ class AppController extends Logging {
this . paginator . setDisable ( false )
}
// todo : include a templating engine for rendering information
def showPage ( pageIndex : Integer ) = {
val itemsPerPage = PropertiesService . get ( "app.ui.thumbsPerPage" , "100" ) . toInt
val startIndex = pageIndex * itemsPerPage
@ -353,6 +324,36 @@ class AppController extends Logging {
this . imageTilePane
}
@FXML
def showSimilarImages ( event : ActionEvent ) = {
resetPaginator ( )
imageTilePane . getChildren . setAll ( new java . util . ArrayList [ Node ] ( ) )
val f : Future [ List [ Image ] ] = Future {
val similarImages = engine . getSimilarImagesForDirectory ( currentDirectory , recursive = doRecursiveProcessing . isSelected )
val tempImages = new mutable . MutableList [ Image ] ( )
for ( similarImage <- similarImages ) {
debug ( s" Adding similar images ${ similarImage . rootImage . toString } to app " )
tempImages += similarImage . rootImage
similarImage . similarImages . foreach ( image => tempImages += image )
}
tempImages . toList
}
f onComplete {
case Success ( images ) =>
info ( s" Displaying ${ images . length } similar images " )
Platform . runLater ( new Runnable ( ) {
override def run ( ) {
setPagesContent ( images )
showPage ( 0 )
}
} )
case Failure ( t ) =>
error ( "An Error Occurred" , t )
}
}
/* *
* Show a plain text utility dialog
*