Package org.apache.pivot.beans

Examples of org.apache.pivot.beans.BeanAdapter


        sourceLabel = (Label)wtkxSerializer.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


            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

            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

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

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

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

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

                Dictionary<String, Object> dictionary;
                if (value instanceof Dictionary<?, ?>) {
                    dictionary = (Dictionary<String, Object>)value;
                    value = dictionary.get(key);
                } else {
                    dictionary = new BeanAdapter(value);
                }

                if (dictionary.containsKey(key)) {
                    value = dictionary.get(key);
                } else {
View Full Code Here

        } else {
            Dictionary<String, Object> dictionary;
            if (parent instanceof Dictionary<?, ?>) {
                dictionary = (Dictionary<String, Object>)parent;
            } else {
                dictionary = new BeanAdapter(parent);
            }

            previousValue = dictionary.put(key, value);
        }
View Full Code Here

        } else {
            Dictionary<String, Object> dictionary;
            if (parent instanceof Dictionary<?, ?>) {
                dictionary = (Dictionary<String, Object>)parent;
            } else {
                dictionary = new BeanAdapter(parent);
            }

            previousValue = dictionary.remove(key);
        }
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.