Examples of BeanDictionary


Examples of pivot.beans.BeanDictionary

                Dictionary<String, Object> seriesDictionary;
                if (series instanceof Dictionary<?, ?>) {
                    seriesDictionary = (Dictionary<String, Object>)series;
                } else {
                    seriesDictionary = new BeanDictionary(series);
                }

                String seriesNameKey = chartView.getSeriesNameKey();

                Alert.alert("You clicked element " + elementLabel + " in \""
View Full Code Here

Examples of pivot.beans.BeanDictionary

                item = itemClass.newInstance();

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

Examples of pivot.beans.BeanDictionary

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

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

Examples of pivot.beans.BeanDictionary

                                // This element represents a property
                                if (element == null) {
                                    throw new SerializationException("Root node must represent a typed object.");
                                }

                                BeanDictionary propertyDictionary = new BeanDictionary(element.value);

                                if (propertyDictionary.isReadOnly(localName)) {
                                    Object value = propertyDictionary.get(localName);
                                    assert (value != null) : "Read-only properties cannot be null.";
                                    element = new Element(element, Element.Type.READ_ONLY_PROPERTY, attributes, value);
                                } else {
                                    if (attributes.getLength() > 0) {
                                        throw new SerializationException("Writable property elements cannot have attributes.");
                                    }

                                    element = new Element(element, Element.Type.WRITABLE_PROPERTY, null, null);
                                }
                            }
                        }

                        switch (element.type) {
                            case INCLUDE:
                            case INSTANCE: {
                                // If the element's parent is a sequence or a listener list, add
                                // the element value to it
                                if (element.parent != null) {
                                    if (element.parent.value instanceof Sequence) {
                                        Sequence<Object> sequence = (Sequence<Object>)element.parent.value;
                                        sequence.add(element.value);
                                    } else {
                                        if (element.parent.value instanceof ListenerList) {
                                            ListenerList<Object> listenerList = (ListenerList<Object>)element.parent.value;
                                            listenerList.add(element.value);
                                        }
                                    }
                                }

                                // If an ID was specified, add the value to the named object map
                                if (id != null) {
                                    if (id.length() == 0) {
                                        throw new IllegalArgumentException(WTKX_PREFIX + ":" + ID_ATTRIBUTE
                                            + " must not be null.");
                                    }

                                    namedObjects.put(id, element.value);

                                    if (scriptEngineManager != null) {
                                        try {
                                            Method putMethod = scriptEngineManagerClass.getMethod("put",
                                                new Class<?>[] {String.class, Object.class});
                                            putMethod.invoke(scriptEngineManager, new Object[] {id, namedObjects.get(id)});
                                        } catch(Exception exception) {
                                            throw new RuntimeException(exception);
                                        }
                                    }
                                }

                                break;
                            }
                        }

                        break;
                    }

                    case XMLStreamConstants.END_ELEMENT: {
                        String localName = reader.getLocalName();

                        switch (element.type) {
                            case WRITABLE_PROPERTY: {
                                BeanDictionary propertyDictionary = new BeanDictionary(element.parent.value);
                                propertyDictionary.put(localName, element.value);
                                break;
                            }

                            case SCRIPT: {
                                break;
                            }

                            default: {
                                if (element.value instanceof Dictionary) {
                                    // The element is an untyped object
                                    Dictionary<String, Object> dictionary = (Dictionary<String, Object>)element.value;

                                    for (Attribute attribute : element.attributes) {
                                        if (Character.isUpperCase(attribute.localName.charAt(0))) {
                                            throw new SerializationException("Static setters are only supported for typed instances.");
                                        }

                                        // Resolve and apply the attribute
                                        dictionary.put(attribute.localName, resolve(attribute.value, null));
                                    }
                                } else {
                                    // The element represents a typed object; apply the attributes
                                    BeanDictionary valueDictionary = new BeanDictionary(element.value);

                                    for (Attribute attribute : element.attributes) {
                                        if (Character.isUpperCase(attribute.localName.charAt(0))) {
                                            // The property represents an attached value
                                            setStaticProperty(attribute, element.value);
                                        } else {
                                            Class<?> type = valueDictionary.getType(attribute.localName);

                                            if (type != null
                                                && ListenerList.class.isAssignableFrom(type)) {
                                                // The property represents a listener list
                                                ListenerList<Object> listenerList = (ListenerList<Object>)valueDictionary.get(attribute.localName);

                                                // The attribute value is a comma-separated list of listener IDs
                                                String[] listenerIDs = attribute.value.split(",");

                                                for (int i = 0, n = listenerIDs.length; i < n; i++) {
                                                    String listenerID = listenerIDs[i].trim();

                                                    if (listenerID.length() > 0) {
                                                        listenerID = listenerID.substring(1);

                                                        if (listenerID.length() > 0) {
                                                            listenerList.add(namedObjectDictionary.get(listenerID));
                                                        }
                                                    }
                                                }
                                            } else {
                                                valueDictionary.put(attribute.localName,
                                                    resolve(attribute.value, valueDictionary.getType(attribute.localName)));
                                            }
                                        }
                                    }
                                }
View Full Code Here

Examples of pivot.beans.BeanDictionary

            && context.containsKey(contextKey)) {
            Object value = context.get(contextKey);
            if (value instanceof Dictionary<?, ?>) {
                context = (Map<String, Object>)value;
            } else {
                context = new BeanDictionary(value);
            }
        }

        for (Component component : components) {
            component.load(context);
View Full Code Here

Examples of pivot.beans.BeanDictionary

            // Bound value is expected to be a sub-context
            Object value = context.get(contextKey);
            if (value instanceof Dictionary<?, ?>) {
                context = (Map<String, Object>)value;
            } else {
                context = new BeanDictionary(value);
            }
        }

        for (Component component : components) {
            component.store(context);
View Full Code Here

Examples of pivot.beans.BeanDictionary

        public int compare(Object o1, Object o2) {
            Dictionary<String, ?> row1;
            if (o1 instanceof Dictionary<?, ?>) {
                row1 = (Dictionary<String, ?>)o1;
            } else {
                row1 = new BeanDictionary(o1);
            }

            Dictionary<String, ?> row2;
            if (o2 instanceof Dictionary<?, ?>) {
                row2 = (Dictionary<String, ?>)o2;
            } else {
                row2 = new BeanDictionary(o2);
            }

            Comparable<Object> comparable = (Comparable<Object>)row1.get(columnName);
            Object value = row2.get(columnName);
View Full Code Here

Examples of pivot.beans.BeanDictionary

            if (columnName != null) {
                Dictionary<String, Object> rowData;
                if (value instanceof Dictionary<?, ?>) {
                    rowData = (Dictionary<String, Object>)value;
                } else {
                    rowData = new BeanDictionary(value);
                }

                Object cellData = rowData.get(columnName);

                if (cellData instanceof Date) {
View Full Code Here

Examples of pivot.beans.BeanDictionary

            if (columnName != null) {
                Dictionary<String, Object> rowData;
                if (value instanceof Dictionary<?, ?>) {
                    rowData = (Dictionary<String, Object>)value;
                } else {
                    rowData = new BeanDictionary(value);
                }

                cellData = rowData.get(columnName);
            }
View Full Code Here

Examples of pivot.beans.BeanDictionary

            if (columnName != null) {
                Dictionary<String, Object> rowData;
                if (value instanceof Dictionary<?, ?>) {
                    rowData = (Dictionary<String, Object>)value;
                } else {
                    rowData = new BeanDictionary(value);
                }

                Object cellData = rowData.get(columnName);

                if (cellData instanceof String) {
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.