Examples of BeanAdapter


Examples of org.apache.pivot.beans.BeanAdapter

        sourceLabel = (Label)namespace.get("sourceLabel");

        loadJavaButton.getButtonPressListeners().add(new ButtonPressListener() {
            @Override
            public void buttonPressed(Button button) {
                form.load(new BeanAdapter(CONTACT));
                sourceLabel.setText("Java");
            }
        });

        loadJSONButton.getButtonPressListeners().add(new ButtonPressListener() {
View Full Code Here

Examples of org.apache.pivot.beans.BeanAdapter

        // skin, so use similar logic to BXMLSerializer
        DefaultProperty defaultProperty = container.getClass().getAnnotation(DefaultProperty.class);
        if (defaultProperty != null) {
            TreeBranch branch = new TreeBranch(nameForObject(container));
            String defaultPropertyName = defaultProperty.value();
            BeanAdapter beanAdapter = new BeanAdapter(container);
            if (!beanAdapter.containsKey(defaultPropertyName)) {
                throw new IllegalStateException("default property " + defaultPropertyName
                    + " not found on " + container);
            }
            Object defaultPropertyValue = beanAdapter.get(defaultPropertyName);
            if (defaultPropertyValue != null) {
                if (defaultPropertyValue instanceof Component) {
                    TreeNode childBranch = analyseObjectTree(defaultPropertyValue);
                    branch.add(childBranch);
                }
View Full Code Here

Examples of org.apache.pivot.beans.BeanAdapter

                }

                if (item instanceof Dictionary<?, ?>) {
                    itemDictionary = (Dictionary<String, Object>)item;
                } else {
                    itemDictionary = new BeanAdapter(item);
                }
            } catch(IllegalAccessException exception) {
                throw new SerializationException(exception);
            } catch(InstantiationException exception) {
                throw new SerializationException(exception);
View Full Code Here

Examples of org.apache.pivot.beans.BeanAdapter

        for (Object item : items) {
            Dictionary<String, Object> itemDictionary;
            if (item instanceof Dictionary<?, ?>) {
                itemDictionary = (Dictionary<String, Object>)item;
            } else {
                itemDictionary = new BeanAdapter(item);
            }

            for (int i = 0, n = keys.getLength(); i < n; i++) {
                String key = keys.get(i);
View Full Code Here

Examples of org.apache.pivot.beans.BeanAdapter

            }

            String key = keys.get(i);

            Map<String, T> adapter = (Map<String, T>) (value instanceof java.util.Map ? new MapAdapter<String, T>((java.util.Map<String, T>) value) :
                    (value instanceof org.apache.pivot.collections.Map ? ((org.apache.pivot.collections.Map<String, T>) value): new BeanAdapter(value)));
            if (adapter.containsKey(key)) {
                value = adapter.get(key);
            } else if (value instanceof Sequence<?>) {
                Sequence<Object> sequence = (Sequence<Object>)value;
                value = sequence.get(Integer.parseInt(key));
View Full Code Here

Examples of org.apache.pivot.beans.BeanAdapter

        if (parent == null) {
            throw new IllegalArgumentException("Invalid path.");
        }

        Map<String, T> adapter = (Map<String, T>) (parent instanceof java.util.Map ? new MapAdapter<String, T>((java.util.Map<String, T>) parent) :
                (parent instanceof org.apache.pivot.collections.Map ? ((org.apache.pivot.collections.Map<String, T>) parent): new BeanAdapter(parent)));

        Object previousValue;
        if (adapter.containsKey(key)) {
            previousValue = adapter.put(key, value);
        } else if (parent instanceof Sequence<?>) {
View Full Code Here

Examples of org.apache.pivot.beans.BeanAdapter

        boolean containsKey;
        if (parent == null) {
            containsKey = false;
        } else {
            Map<String, T> adapter = (Map<String, T>) (parent instanceof java.util.Map ? new MapAdapter<String, T>((java.util.Map<String, T>) parent) :
                    (parent instanceof org.apache.pivot.collections.Map ? ((org.apache.pivot.collections.Map<String, T>) parent): new BeanAdapter(parent)));
            containsKey = adapter.containsKey(key);

            if (!containsKey) {
                if (parent instanceof Sequence<?>) {
                    Sequence<Object> sequence = (Sequence<Object>)parent;
View Full Code Here

Examples of org.apache.pivot.beans.BeanAdapter

            Class<?> sourceType = source.getClass();
            HashMap<Class<?>, List<String>> declaringClassPartitions =
                new HashMap<Class<?>, List<String>>(classComparator);

            // Partition the properties by their declaring class
            BeanAdapter beanAdapter = new BeanAdapter(source);
            for (String propertyName : beanAdapter) {
                if (beanMonitor.isNotifying(propertyName)
                    && !beanAdapter.isReadOnly(propertyName)) {
                    Method method = BeanAdapter.getGetterMethod(sourceType, propertyName);
                    Class<?> declaringClass = method.getDeclaringClass();

                    List<String> propertyNames = declaringClassPartitions.get(declaringClass);
                    if (propertyNames == null) {
                        propertyNames = new ArrayList<String>(nameComparator);
                        declaringClassPartitions.put(declaringClass, propertyNames);
                    }

                    propertyNames.add(propertyName);
                }
            }

            // Add the controls
            for (Class<?> declaringClass : declaringClassPartitions) {
                Form.Section section = new Form.Section();
                section.setHeading(declaringClass.getSimpleName());
                sections.add(section);

                List<String> propertyNames = declaringClassPartitions.get(declaringClass);
                for (String propertyName : propertyNames) {
                    Class<?> type = beanAdapter.getType(propertyName);
                    addControl(beanAdapter, propertyName, type, section);
                }
            }
        }
    }
View Full Code Here

Examples of org.apache.pivot.beans.BeanAdapter

            Class<?> sourceType = source.getClass();
            HashMap<Class<?>, List<String>> declaringClassPartitions =
                new HashMap<Class<?>, List<String>>(classComparator);

            // Partition the properties by their declaring class
            BeanAdapter beanAdapter = new BeanAdapter(source);
            for (String propertyName : beanAdapter) {
                if (beanMonitor.isNotifying(propertyName)
                    && !beanAdapter.isReadOnly(propertyName)) {
                    Method method = BeanAdapter.getGetterMethod(sourceType, propertyName);
                    Class<?> declaringClass = method.getDeclaringClass();

                    List<String> propertyNames = declaringClassPartitions.get(declaringClass);
                    if (propertyNames == null) {
                        propertyNames = new ArrayList<String>(nameComparator);
                        declaringClassPartitions.put(declaringClass, propertyNames);
                    }

                    propertyNames.add(propertyName);
                }
            }

            // Add the controls
            for (Class<?> declaringClass : declaringClassPartitions) {
                Form.Section section = new Form.Section();
                section.setHeading(declaringClass.getSimpleName());
                sections.add(section);

                List<String> propertyNames = declaringClassPartitions.get(declaringClass);
                for (String propertyName : propertyNames) {
                    Class<?> type = beanAdapter.getType(propertyName);
                    addControl(beanAdapter, propertyName, type, section);
                }
            }
        }
    }
View Full Code Here

Examples of org.apache.pivot.beans.BeanAdapter

        if (this.skin != null) {
            throw new IllegalStateException("Skin is already installed.");
        }

        this.skin = skin;
        styles = new BeanAdapter(skin);
        skin.install(this);

        // Apply any defined type styles
        LinkedList<Class<?>> styleTypes = new LinkedList<Class<?>>();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.