summaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/ui/AbstractOrderedLayout.java
diff options
context:
space:
mode:
authorMatti Tahvonen <matti.tahvonen@itmill.com>2009-08-20 16:24:20 +0000
committerMatti Tahvonen <matti.tahvonen@itmill.com>2009-08-20 16:24:20 +0000
commit58ca7c6ce118b3f0f9789b3419caf70877a7de23 (patch)
treeeab643f121fab81cb5ec8d801521e7c2e66d3294 /src/com/vaadin/ui/AbstractOrderedLayout.java
parent1866f7fee8ff811594174afe2486ef73e3f7a29c (diff)
downloadvaadin-framework-58ca7c6ce118b3f0f9789b3419caf70877a7de23.tar.gz
vaadin-framework-58ca7c6ce118b3f0f9789b3419caf70877a7de23.zip
Large pile of various optimizations and small bug fixes. Changeset has a great regression risk, blame me on new odd bugs.
* default alignments/expandratios now not transported over uidl * added new map type to painttarget * rewrote UIDL with overlay type * ditched gwt JSON implementation instead of own "overlay type" altogether * using arraylist instead of vector in all places on client side * optimized a bit LocaleService * rewrote uidl browsers in debug window (now does not stall IE that easily with large changesets) svn changeset:8516/svn branch:6.1
Diffstat (limited to 'src/com/vaadin/ui/AbstractOrderedLayout.java')
-rw-r--r--src/com/vaadin/ui/AbstractOrderedLayout.java54
1 files changed, 5 insertions, 49 deletions
diff --git a/src/com/vaadin/ui/AbstractOrderedLayout.java b/src/com/vaadin/ui/AbstractOrderedLayout.java
index 573f92c53b..762a447456 100644
--- a/src/com/vaadin/ui/AbstractOrderedLayout.java
+++ b/src/com/vaadin/ui/AbstractOrderedLayout.java
@@ -8,7 +8,6 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map;
-import java.util.Map.Entry;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
@@ -133,58 +132,15 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements
target.addAttribute("spacing", spacing);
}
- final String[] alignmentsArray = new String[components.size()];
- final Integer[] expandRatioArray = new Integer[components.size()];
- float sum = getExpandRatioSum();
- boolean equallyDivided = false;
- int realSum = 0;
- if (sum == 0 && components.size() > 0) {
- // no component has been expanded, all components have same expand
- // rate
- equallyDivided = true;
- float equalSize = 1 / (float) components.size();
- int myRatio = Math.round(equalSize * 1000);
- for (int i = 0; i < expandRatioArray.length; i++) {
- expandRatioArray[i] = myRatio;
- }
- realSum = myRatio * components.size();
- }
-
// Adds all items in all the locations
- int index = 0;
- for (final Iterator i = components.iterator(); i.hasNext();) {
- final Component c = (Component) i.next();
- if (c != null) {
- // Paint child component UIDL
- c.paint(target);
- alignmentsArray[index] = String
- .valueOf(getComponentAlignment(c).getBitMask());
- if (!equallyDivided) {
- int myRatio = Math.round((getExpandRatio(c) / sum) * 1000);
- expandRatioArray[index] = myRatio;
- realSum += myRatio;
- }
- index++;
- }
- }
-
- // correct possible rounding error
- if (expandRatioArray.length > 0) {
- expandRatioArray[0] -= realSum - 1000;
+ for (Component c : components) {
+ // Paint child component UIDL
+ c.paint(target);
}
// Add child component alignment info to layout tag
- target.addAttribute("alignments", alignmentsArray);
- target.addAttribute("expandRatios", expandRatioArray);
- }
-
- private float getExpandRatioSum() {
- float sum = 0;
- for (Iterator<Entry<Component, Float>> iterator = componentToExpandRatio
- .entrySet().iterator(); iterator.hasNext();) {
- sum += iterator.next().getValue();
- }
- return sum;
+ target.addAttribute("alignments", componentToAlignment);
+ target.addAttribute("expandRatios", componentToExpandRatio);
}
/* Documented in superclass */