public static synchronized Integer getValue(Object layout,
            String key, int type) {
        Integer ret = null;
        boolean cont = true;

        for (int i = LAYOUTS.size() - 1; i >= 0;
                i--) {
            Object l = LAYOUTS.get(i).get();
            if (ret == null && l == layout) {
                int[] rect = VALUES_TEMP.get(i).get(key);
                if (cont && rect != null &&
                        rect[type] != LayoutUtil.NOT_SET) {
                    ret = new Integer(rect[type]);
                } else {
                    rect = VALUES.get(i).get(key);
                    ret =   (rect != null &&
                            rect[type] !=
                            LayoutUtil.NOT_SET)
                            ? new Integer(rect[type]) : null;
                }
                cont = false;
            }

            if (l == null) {
                LAYOUTS.remove(i);
                VALUES.remove(i);
                VALUES_TEMP.remove(i);
            }
        }
        return ret;
    }