Revision: 4632 http://sourceforge.net/p/vexi/code/4632 Author: clrg Date: 2013-12-24 02:20:56 +0000 (Tue, 24 Dec 2013) Log Message: -----------
Modified Paths: -------------- branches/vexi4c/org.vexi-core.main/src/main/jpp/org/vexi/ui/Box.jpp Modified: branches/vexi4c/org.vexi-core.main/src/main/jpp/org/vexi/ui/Box.jpp =================================================================== --- branches/vexi4c/org.vexi-core.main/src/main/jpp/org/vexi/ui/Box.jpp 2013-12-23 03:16:07 UTC (rev 4631) +++ branches/vexi4c/org.vexi-core.main/src/main/jpp/org/vexi/ui/Box.jpp 2013-12-24 02:20:56 UTC (rev 4632) @@ -216,7 +216,7 @@ // useful debugging //private final int depth() { return parent==null ? 0 : parent.depth()+1; } - private final String name() { try { return get(JSU.S("name")).toString(); } catch (JSExn e) { throw new Error(); } } + private final String name() { try { JS str = get(JSU.S("name")); return str==null?"null":str.toString(); } catch (JSExn e) { throw new Error(); } } private static final int min(int a, int b) { return (a<b) ? a : b; } private static final int max(int a, int b) { return (a>b) ? a : b; } @@ -798,7 +798,8 @@ // our layout lies somewhere between the min and max size, // loop over the children attempting to set their width to // targetsize and adjust until it meets the parent width - float targetsize = (float)(width - box_spacing) / (float)treeSize(); + int packingspace = width - box_spacing; + float targetsize = (float)(packingspace) / (float)treeSize(); float totalsize = 0; for (int j=0; j<100; j++) { totalsize = 0; @@ -841,27 +842,27 @@ // test to see if targetsize produces a solution that rounds // to match the width, adjusting appropriately if it does not int totalsize_int = (int)(totalsize+0.5); - if (totalsize_int - box_spacing > width) { + if (totalsize_int > packingspace) { if (num_nolimit>0) { - targetsize -= (totalsize-(float)width)/(float)num_nolimit; + targetsize -= (totalsize-(float)packingspace)/(float)num_nolimit; } else { if (num_minsize+num_passive==num_active) { // no solution required - available min-sizes over-consume width targetsize = width; break; } - targetsize = (float)max_maxsize - (totalsize-(float)width)/(float)num_maxsize; + targetsize = (float)max_maxsize - (totalsize-(float)packingspace)/(float)num_maxsize; } - } else if (totalsize_int - box_spacing < width) { + } else if (totalsize_int < packingspace) { if (num_nolimit>0) { - targetsize += ((float)width-totalsize)/(float)num_nolimit; + targetsize += ((float)packingspace-totalsize)/(float)num_nolimit; } else { if (num_maxsize+num_passive==num_active) { // no solution required - available max-sizes do not consume width targetsize = width; break; } - targetsize = (float)min_minsize + ((float)width-totalsize)/(float)num_minsize; + targetsize = (float)min_minsize + ((float)packingspace-totalsize)/(float)num_minsize; } } else { break; @@ -944,7 +945,8 @@ // our layout lies somewhere between the min and max size, // loop over the children attempting to set their width to // targetsize and adjust until it meets the parent width - float targetsize = (float)(height - box_spacing) / (float)treeSize(); + int packingspace = height - box_spacing; + float targetsize = (float)packingspace / (float)treeSize(); float totalsize = 0; for (int j=0; j<100; j++) { totalsize = 0; @@ -987,27 +989,27 @@ // test to see if targetsize produces a solution that rounds // to match the height, adjusting appropriately if it does not int totalsize_int = (int)(totalsize+0.5); - if (totalsize_int - box_spacing > height) { + if (totalsize_int > packingspace) { if (num_nolimit>0) { - targetsize -= (totalsize-(float)height)/(float)num_nolimit; + targetsize -= (totalsize-(float)packingspace)/(float)num_nolimit; } else { if (num_minsize+num_passive==num_active) { // no solution required - available min-sizes over-consume height targetsize = height; break; } - targetsize = (float)max_maxsize - (totalsize-(float)height)/(float)num_maxsize; + targetsize = (float)max_maxsize - (totalsize-(float)packingspace)/(float)num_maxsize; } - } else if (totalsize_int - box_spacing < height) { + } else if (totalsize_int < packingspace) { if (num_nolimit>0) { - targetsize += ((float)height-totalsize)/(float)num_nolimit; + targetsize += ((float)packingspace-totalsize)/(float)num_nolimit; } else { if (num_maxsize+num_passive==num_active) { // no solution required - available max-sizes do not consume height targetsize = height; break; } - targetsize = (float)min_minsize + ((float)height-totalsize)/(float)num_minsize; + targetsize = (float)min_minsize + ((float)packingspace-totalsize)/(float)num_minsize; } } else { break; @@ -1823,21 +1825,22 @@ //#end } } catch (NullPointerException npe) { - throw new JSExn("Cannot call "+method+"() with null arguments"); + throw new JSExn("Cannot call '"+method+"()' with null arguments"); } - throw new JSExn("Incorrect number of arguments for Box method "+method+"()"); + throw new JSExn("Incorrect number of arguments for Box method '"+method+"()'"); } - + + /** returns true if there is a redirect to consume the attempted put */ final private boolean tryRedirect(JS name, JS value) throws JSExn { if (redirect == null) { - throw new JSExn("Attempt to set "+name+" on a box with a null redirect"); + throw new JSExn("Attempt to set '"+name+"' on a box with a null redirect"); } if (redirect != this) { redirect.putAndTriggerTraps(name, value); - return false; + return true; } - return true; + return false; } /** implements reading from box properties in JS */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk _______________________________________________ Vexi-svn mailing list Vexi-svn@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/vexi-svn