Stock-Based Compensation - Activity (Details) - USD ($)
3 Months Ended 6 Months Ended
Jan. 31, 2016
Jan. 31, 2016
Jan. 31, 2016
Jan. 31, 2015
Jul. 31, 2015
Stock-Based Compensation          
Total unrecognized stock-based compensation expense, before income taxes, related to total nonvested stock options and stock awards (in dollars) $ 20,138,000 $ 20,138,000 $ 20,138,000    
Remaining weighted average period over which unrecognized stock-based compensation expense is expected to be recognized     23 months    
Stock-based awards, additional disclosure          
Deduction in income tax due to exercise of options and vesting of restricted stock (in dollars)     $ 3,169,000 $ 4,271,000  
Increase in additional paid-in capital due to excess tax benefit on stock-based compensation expense (in dollars)     $ 1,541,000 $ 2,463,000  
2006 Plan          
Stock-based awards, additional disclosure          
Shares available for grant 0 0 0    
2016 Plan          
Stock-based awards, additional disclosure          
Maximum number of shares authorized for issuance 1,200,000 1,200,000 1,200,000    
Awards Granted (in shares) 0        
Percentage of awards that vest on each of the first three anniversaries of grant date subject to active employment     33.30%    
Restricted shares          
Number of Shares          
Nonvested stock awards at the beginning of the period (in shares)     343,519    
Granted (in shares)     162,265    
Cancelled (in shares)     (1,823)    
Vested (in shares)     (163,297)    
Nonvested stock awards at the end of the period (in shares) 340,664 340,664 340,664    
Weighted Average Fair Value          
Nonvested stock awards at the beginning of the period (in dollars per share)     $ 32.77    
Granted (in dollars per share)     54.25    
Cancelled (in dollars per share)     37.57    
Vested (in dollars per share)     27.99    
Nonvested stock awards at the end of the period (in dollars per share) $ 45.27 $ 45.27 $ 45.27    
Stock options          
Weighted-Average Black-Scholes Option Valuation Assumptions          
Dividend yield (as a percent)     0.22% 0.25%  
Expected volatility (as a percent)     55.90% 33.90%  
Risk-free interest rate (as a percent)     1.41% 1.55%  
Expected lives     5 years 5 years  
Stock options, additional disclosure          
Weighted average fair value of all options granted (in dollars per share)     $ 26.49 $ 11.54  
Aggregate intrinsic value of all options exercised (in dollars)   $ 0 $ 0 $ 2,420,000  
Number of Shares          
Outstanding at the beginning of the period (in shares)     107,500    
Granted (in shares)     15,000    
Outstanding at the end of the period (in shares) 122,500 122,500 122,500    
Exercisable at the end of the period (in shares) 80,834 80,834 80,834   45,000
Weighted Average Exercise Price          
Outstanding at the beginning of the period (in dollars per share)     $ 25.73    
Granted (in dollars per share)     55.36    
Outstanding at the end of the period (in dollars per share) $ 29.36 $ 29.36 29.36    
Exercisable at the end of the period (in dollars per share) $ 22.72 $ 22.72 $ 22.72   $ 20.32