Package org.apache.pivot.beans

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


            dictionary = new HashMap<String, Object>();
            valueType = Object.class;
        } else {
            Class<?> beanType = (Class<?>)type;
            try {
                dictionary = new BeanAdapter(beanType.newInstance());
            } catch (InstantiationException exception) {
                throw new RuntimeException(exception);
            } catch (IllegalAccessException exception) {
                throw new RuntimeException(exception);
            }
View Full Code Here

        } else {
            Map<String, Object> map;
            if (object instanceof Map<?, ?>) {
                map = (Map<String, Object>)object;
            } else {
                map = new BeanAdapter(object);
            }

            writer.append("{");

            int i = 0;
View Full Code Here

            this.columnIndex = columnIndex;

            // Get the row data, represented as a Dictionary
            Object tableRow = tableView.getTableData().get(rowIndex);
            Dictionary<String, Object> rowData;
            BeanAdapter beanAdapter = null;
            if (tableRow instanceof Dictionary<?, ?>) {
                rowData = (Dictionary<String, Object>)tableRow;
            } else {
                beanAdapter = new BeanAdapter(tableRow);
                rowData = beanAdapter;
            }

            // Set up the editor component hierarchy
            scrollPane = new ScrollPane(ScrollPane.ScrollBarPolicy.NEVER,
                ScrollPane.ScrollBarPolicy.FILL);
            setContent(scrollPane);

            cardPane = new CardPane();
            scrollPane.setView(cardPane);

            cardPane.add(new ImageView(new ComponentImage(tableView,
                tableView.getRowBounds(rowIndex))));
            cardPane.setSelectedIndex(0);
            cardPane.getStyles().put("selectionChangeEffect", editEffect);
            cardPane.getStyles().put("selectionChangeDuration", editEffectDuration);

            tablePane = new TablePane();
            tablePane.getStyles().put("horizontalSpacing", 1);
            cardPane.add(tablePane);

            TablePane.Row tablePaneRow = new TablePane.Row(1, true);
            tablePane.getRows().add(tablePaneRow);

            // Match the table pane's columns to the table view's
            TableView.ColumnSequence tableViewColumns = tableView.getColumns();
            TablePane.ColumnSequence tablePaneColumns = tablePane.getColumns();

            for (int i = 0, n = tableViewColumns.getLength(); i < n; i++) {
                // Add a new column to the table pane to match the table view column
                TablePane.Column tablePaneColumn = new TablePane.Column();
                tablePaneColumns.add(tablePaneColumn);

                // Determine which component to use as the editor for this column
                String columnName = tableViewColumns.get(i).getName();
                Component editorComponent = null;
                if (columnName != null) {
                    editorComponent = cellEditors.get(columnName);
                }

                // Default to a TextInput editor
                if (editorComponent == null) {
                    TextInput editorTextInput = new TextInput();
                    editorTextInput.setTextKey(columnName);
                    editorComponent = editorTextInput;

                    // Disable the text input for read-only properties
                    if (beanAdapter != null
                        && beanAdapter.isReadOnly(columnName)) {
                        editorTextInput.setTextBindType(BindType.LOAD);
                        editorTextInput.setEnabled(false);
                    }
                }
View Full Code Here

                Object tableRow = tableData.get(rowIndex);
                Dictionary<String, Object> rowData;
                if (tableRow instanceof Dictionary<?, ?>) {
                    rowData = (Dictionary<String, Object>)tableRow;
                } else {
                    rowData = new BeanAdapter(tableRow);
                }

                // Update the row data using data binding
                tablePane.store(rowData);
View Full Code Here

        Object tableRow = tableView.getTableData().get(rowIndex);
        Dictionary<String, Object> rowData;
        if (tableRow instanceof Dictionary<?, ?>) {
            rowData = (Dictionary<String, Object>)tableRow;
        } else {
            BeanAdapter beanAdapter = new BeanAdapter(tableRow);
            isReadOnly = beanAdapter.isReadOnly(columnName);
            rowData = beanAdapter;
        }

        if (!isReadOnly) {
            Vote vote = rowEditorListeners.previewEditRow(this, tableView, rowIndex, columnIndex);
View Full Code Here

            Object tableRow = tableData.get(rowIndex);
            Dictionary<String, Object> rowData;
            if (tableRow instanceof Dictionary<?, ?>) {
                rowData = (Dictionary<String, Object>)tableRow;
            } else {
                rowData = new BeanAdapter(tableRow);
            }

            // Update the cell data
            rowData.put(columnName, text);
View Full Code Here

            // Instantiate the dictionary or bean type
            if (valueType == null) {
                Class<?> beanType = (Class<?>)typeArgument;

                try {
                    dictionary = new BeanAdapter(beanType.newInstance());
                } catch (InstantiationException exception) {
                    throw new RuntimeException(exception);
                } catch (IllegalAccessException exception) {
                    throw new RuntimeException(exception);
                }
View Full Code Here

        } else {
            Map<String, Object> map;
            if (object instanceof Map<?, ?>) {
                map = (Map<String, Object>)object;
            } else {
                map = new BeanAdapter(object, true);
            }

            writer.append("{");

            int i = 0;
View Full Code Here

                }

                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

TOP

Related Classes of org.apache.pivot.beans.BeanAdapter

Copyright © 2018 www.massapicom. 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.