Examples of TextInput


Examples of org.apache.pivot.wtk.TextInput

        @Override
        public void run() {
            caretOn = !caretOn;

            if (caret != null) {
                TextInput textInput = (TextInput)getComponent();
                textInput.repaint(caret.x, caret.y, caret.width, caret.height, true);
            }
        }
View Full Code Here

Examples of org.apache.pivot.wtk.TextInput

    }

    private class ScrollSelectionCallback implements Runnable {
        @Override
        public void run() {
            TextInput textInput = (TextInput)getComponent();
            int selectionStart = textInput.getSelectionStart();
            int selectionLength = textInput.getSelectionLength();
            int selectionEnd = selectionStart + selectionLength - 1;

            switch (scrollDirection) {
                case FORWARD: {
                    TextNode textNode = textInput.getTextNode();
                    if (selectionEnd < textNode.getCharacterCount() - 1) {
                        selectionEnd++;
                        textInput.setSelection(selectionStart, selectionEnd - selectionStart + 1);
                        scrollCharacterToVisible(selectionEnd);
                    }

                    break;
                }

                case BACKWARD: {
                    if (selectionStart > 0) {
                        selectionStart--;
                        textInput.setSelection(selectionStart, selectionEnd - selectionStart + 1);
                        scrollCharacterToVisible(selectionStart);
                    }

                    break;
                }
View Full Code Here

Examples of org.apache.pivot.wtk.TextInput

                    editorComponent = cellEditors.get(columnName);
                }

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

                // Disable the component for read-only properties. Components
                // that are already disabled must be custom cell editor
View Full Code Here

Examples of org.apache.pivot.wtk.TextInput

        ListButton typeListButton = new ListButton(new EnumList<ExpenseType>(ExpenseType.class));
        typeListButton.setSelectedItemKey("type");
        tableViewRowEditor.getCellEditors().put("type", typeListButton);

        // Amount uses a TextInput with strict currency validation
        TextInput amountTextInput = new TextInput();
        amountTextInput.setValidator(new CurrencyValidator());
        amountTextInput.getStyles().put("strictValidation", true);
        amountTextInput.setTextKey("amount");
        tableViewRowEditor.getCellEditors().put("amount", amountTextInput);

        window.open(display);
    }
View Full Code Here

Examples of org.apache.pivot.wtk.TextInput

        return textInput;
    }

    private void updateIntControl(Dictionary<String, Object> dictionary, String key) {
        TextInput textInput = (TextInput)controls.get(key);

        if (textInput != null) {
            int value = (Integer)dictionary.get(key);
            textInput.setText(String.valueOf(value));
        }
    }
View Full Code Here

Examples of org.apache.pivot.wtk.TextInput

    private Component addFloatControl(final Dictionary<String, Object> dictionary,
        final String key, Form.Section section) {
        float value = (Float)dictionary.get(key);

        TextInput textInput = new TextInput();
        textInput.setTextSize(10);
        textInput.setValidator(new FloatValidator());
        textInput.setText(String.valueOf(value));
        section.add(textInput);
        Form.setLabel(textInput, key);

        textInput.getComponentStateListeners().add(new ComponentStateListener.Adapter() {
            @Override
            public void focusedChanged(Component component, Component obverseComponent) {
                if (!component.isFocused()) {
                    TextInput textInput = (TextInput)component;

                    try {
                        dictionary.put(key, Float.parseFloat(textInput.getText()));
                    } catch (Exception exception) {
                        displayErrorMessage(exception, component.getWindow());
                        float value = (Float)dictionary.get(key);
                        textInput.setText(String.valueOf(value));
                    }
                }
            }
        });
View Full Code Here

Examples of org.apache.pivot.wtk.TextInput

        return textInput;
    }

    private void updateFloatControl(Dictionary<String, Object> dictionary, String key) {
        TextInput textInput = (TextInput)controls.get(key);

        if (textInput != null) {
            float value = (Float)dictionary.get(key);
            textInput.setText(String.valueOf(value));
        }
    }
View Full Code Here

Examples of org.apache.pivot.wtk.TextInput

    private Component addDoubleControl(final Dictionary<String, Object> dictionary,
        final String key, Form.Section section) {
        double value = (Double)dictionary.get(key);

        TextInput textInput = new TextInput();
        textInput.setTextSize(14);
        textInput.setValidator(new DoubleValidator());
        textInput.setText(String.valueOf(value));
        section.add(textInput);
        Form.setLabel(textInput, key);

        textInput.getComponentStateListeners().add(new ComponentStateListener.Adapter() {
            @Override
            public void focusedChanged(Component component, Component obverseComponent) {
                if (!component.isFocused()) {
                    TextInput textInput = (TextInput)component;

                    try {
                        dictionary.put(key, Double.parseDouble(textInput.getText()));
                    } catch (Exception exception) {
                        displayErrorMessage(exception, component.getWindow());
                        double value = (Double)dictionary.get(key);
                        textInput.setText(String.valueOf(value));
                    }
                }
            }
        });
View Full Code Here

Examples of org.apache.pivot.wtk.TextInput

        return textInput;
    }

    private void updateDoubleControl(Dictionary<String, Object> dictionary, String key) {
        TextInput textInput = (TextInput)controls.get(key);

        if (textInput != null) {
            double value = (Double)dictionary.get(key);
            textInput.setText(String.valueOf(value));
        }
    }
View Full Code Here

Examples of org.apache.pivot.wtk.TextInput

    private Component addStringControl(final Dictionary<String, Object> dictionary,
        final String key, Form.Section section) {
        String value = (String)dictionary.get(key);

        TextInput textInput = new TextInput();
        textInput.setText(value == null ? "" : value);
        section.add(textInput);
        Form.setLabel(textInput, key);

        textInput.getComponentStateListeners().add(new ComponentStateListener.Adapter() {
            @Override
            public void focusedChanged(Component component, Component obverseComponent) {
                if (!component.isFocused()) {
                    TextInput textInput = (TextInput)component;

                    try {
                        dictionary.put(key, textInput.getText());
                    } catch (Exception exception) {
                        displayErrorMessage(exception, component.getWindow());
                        String value = (String)dictionary.get(key);
                        textInput.setText(value == null ? "" : value);
                    }
                }
            }
        });
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.