private void handleShuffleState ( final Request request ) { String json = request . getParameter ( SHUFFLE_REQUEST_KEY ) ; if ( Util . empty ( json ) ) { return ; } // New TreeItemIdNode newTree ; try { newTree = TreeItemUtil . convertJsonToTree ( json ) ; } catch ( Exception e ) { LOG . warn ( "Could not parse JSON for shuffle tree items. " + e . getMessage ( ) ) ; return ; } // Current TreeItemIdNode currentTree = getCustomTree ( ) ; boolean changed = ! TreeItemUtil . isTreeSame ( newTree , currentTree ) ; if ( changed ) { setCustomTree ( newTree ) ; // Run the shuffle action (if set) final Action action = getShuffleAction ( ) ; if ( action != null ) { final ActionEvent event = new ActionEvent ( this , "shuffle" ) ; Runnable later = new Runnable ( ) { @ Override public void run ( ) { action . execute ( event ) ; } } ; invokeLater ( later ) ; } } }
Handle the tree items that have been shuffled by the client .