leif 2002/10/25 09:45:03 Modified: instrument-client/src/java/org/apache/excalibur/instrument/client InstrumentClientFrame.java Log: Do some more tuning to the tiling algorithm to make the frames resize in such a way as to make their contents useful even in extreme cases. Revision Changes Path 1.6 +10 -7 jakarta-avalon-excalibur/instrument-client/src/java/org/apache/excalibur/instrument/client/InstrumentClientFrame.java Index: InstrumentClientFrame.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/instrument-client/src/java/org/apache/excalibur/instrument/client/InstrumentClientFrame.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- InstrumentClientFrame.java 25 Oct 2002 16:02:00 -0000 1.5 +++ InstrumentClientFrame.java 25 Oct 2002 16:45:03 -0000 1.6 @@ -715,23 +715,26 @@ return; } - // Tile the inner frames so that the individual frames will be shaped - // in a way which is optimized to show the charts that they contain. - // They should be wider than they are high. - // Try to show all frames in a single column. Add columns if the - // individual frame heights are less that 1/3 of their width. + // Target the frames at the specified maximum aspect ratio. The + // additional constraint that the frames will not be allowed to + // be less than 70 pixels in height unless their width is less + // than 100. + float targetRatio = 5.0f; Dimension size = getDesktopPane().getSize(); - int rows = count; int cols = 1; + int rows = count; int frameWidth = size.width / cols; int frameHeight = size.height / rows; - while ( frameHeight < frameWidth / 3 ) + float ratio = (float)frameWidth / frameHeight; + while ( ( rows > 1 ) && ( ( ratio > targetRatio ) || + ( ( frameHeight < 70 ) && ( frameWidth > 100 ) ) ) ) { cols++; rows = (int)Math.ceil( (float)count / cols ); frameWidth = size.width / cols; frameHeight = size.height / rows; + ratio = (float)frameWidth / frameHeight; } reorganizeFrames( rows, cols, openframes );
-- To unsubscribe, e-mail: <mailto:avalon-cvs-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:avalon-cvs-help@;jakarta.apache.org>