Package org.apache.pivot.wtk

Examples of org.apache.pivot.wtk.Span


                File selectedFile = selectedFiles.get(i);

                List<File> files = (List<File>)fileTableView.getTableData();
                int index = files.indexOf(selectedFile);
                if (index != -1) {
                    selectedRanges.add(new Span(index, index));
                }
            }

            updatingSelection = true;
            fileTableView.setSelectedRanges(selectedRanges);
View Full Code Here


                            // Select the range
                            ArrayList<Span> selectedRanges = new ArrayList<Span>();
                            int startIndex = listView.getFirstSelectedIndex();
                            int endIndex = listView.getLastSelectedIndex();

                            Span selectedRange = (itemIndex > startIndex) ?
                                new Span(startIndex, itemIndex) : new Span(itemIndex, endIndex);
                            selectedRanges.add(selectedRange);

                            listView.setSelectedRanges(selectedRanges);
                        }
                    } else if (Keyboard.isPressed(commandModifier)
View Full Code Here

        // Repaint only the area that changed (intersection of previous and new selection)

        int rangeStart = 0;
        int rangeEnd = listData.getLength() - 1;
        for (int i = 0; i < previousSelectedRanges.getLength(); i++) {
            Span span = previousSelectedRanges.get(i);
            rangeStart = Math.min(rangeStart, span.start);
            rangeEnd = Math.max(rangeEnd, span.end);
        }

        Sequence<Span> newSelectedRanges = listView.getSelectedRanges();
        for (int i = 0; i < newSelectedRanges.getLength(); i++) {
            Span span = newSelectedRanges.get(i);
            rangeStart = Math.min(rangeStart, span.start);
            rangeEnd = Math.max(rangeEnd, span.end);
        }

        repaintComponent(0, getItemY(rangeStart),
View Full Code Here

                    if (disabledRowFilter == null) {
                        // Select the range
                        int startIndex = tableView.getFirstSelectedIndex();
                        int endIndex = tableView.getLastSelectedIndex();
                        Span selectedRange = (rowIndex > startIndex) ?
                            new Span(startIndex, rowIndex) : new Span(rowIndex, endIndex);

                        ArrayList<Span> selectedRanges = new ArrayList<Span>();
                        selectedRanges.add(selectedRange);

                        tableView.setSelectedRanges(selectedRanges);
View Full Code Here

        // and new selection)

        int rangeStart = 0;
        int rangeEnd = tableData.getLength() - 1;
        for (int i = 0; i < previousSelectedRanges.getLength(); i++) {
            Span span = previousSelectedRanges.get(i);
            rangeStart = Math.min(rangeStart, span.start);
            rangeEnd = Math.max(rangeEnd, span.end);
        }

        Sequence<Span> newSelectedRanges = tableView.getSelectedRanges();
        for (int i = 0; i < newSelectedRanges.getLength(); i++) {
            Span span = newSelectedRanges.get(i);
            rangeStart = Math.min(rangeStart, span.start);
            rangeEnd = Math.max(rangeEnd, span.end);
        }

        repaintComponent(0, getRowY(rangeStart),
View Full Code Here

                graphics.setFont(font);

                int selectionStart = textArea.getSelectionStart();
                int selectionLength = textArea.getSelectionLength();
                Span selectionRange = new Span(selectionStart, selectionStart + selectionLength - 1);

                int documentOffset = getDocumentOffset();
                Span characterRange = new Span(documentOffset, documentOffset + getCharacterCount() - 1);

                if (selectionLength > 0
                    && characterRange.intersects(selectionRange)) {
                    // Determine the selection bounds
                    int width = getWidth();
                    int height = getHeight();

                    int x0;
View Full Code Here

            for (int i = 0, n = selectedFiles.getLength(); i < n; i++) {
                File selectedFile = selectedFiles.get(i);

                int index = files.indexOf(selectedFile);
                if (index != -1) {
                    selectedRanges.add(new Span(index, index));
                }
            }

            fileTableView.setSelectedRanges(selectedRanges);
        }
View Full Code Here

                if (keyCode == Keyboard.KeyCode.DELETE) {
                    List<Object> listData = (List<Object>)listView.getListData();

                    Sequence<Span> selectedRanges = listView.getSelectedRanges();
                    for (int i = selectedRanges.getLength() - 1; i >= 0; i--) {
                        Span selectedRange = selectedRanges.get(i);
                        listData.remove(selectedRange.start, selectedRange.end - selectedRange.start + 1);
                    }
                }

                return false;
View Full Code Here

        return boxPane;
    }

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

        BoxPane boxPane = new BoxPane(Orientation.VERTICAL);
        section.add(boxPane);
        Form.setLabel(boxPane, key);

        FlowPane flowPane = new FlowPane();
        flowPane.getStyles().put("alignToBaseline", true);
        flowPane.getStyles().put("horizontalSpacing", 5);
        boxPane.add(flowPane);

        TextInput textInput = new TextInput();
        textInput.setTextSize(10);
        textInput.setMaximumLength(10);
        textInput.setValidator(new IntValidator());
        textInput.setText(span == null ? "" : String.valueOf(span.start));
        flowPane.add(textInput);

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

                    try {
                        int start = Integer.parseInt(textInput.getText());
                        dictionary.put(key, new Span(start, span == null ? start : span.end));
                    } catch (Exception exception) {
                        displayErrorMessage(exception, component.getWindow());
                        textInput.setText(span == null ? "" : String.valueOf(span.start));
                    }
                }
            }
        });

        Label label = new Label("start");
        label.getStyles().put("font", "{italic:true}");
        flowPane.add(label);

        flowPane = new FlowPane();
        flowPane.getStyles().put("alignToBaseline", true);
        flowPane.getStyles().put("horizontalSpacing", 5);
        boxPane.add(flowPane);

        textInput = new TextInput();
        textInput.setTextSize(10);
        textInput.setMaximumLength(10);
        textInput.setValidator(new IntValidator());
        textInput.setText(span == null ? "" : String.valueOf(span.end));
        flowPane.add(textInput);

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

                    try {
                        int end = Integer.parseInt(textInput.getText());
                        dictionary.put(key, new Span(span == null ? end : span.start, end));
                    } catch (Exception exception) {
                        displayErrorMessage(exception, component.getWindow());
                        textInput.setText(span == null ? "" : String.valueOf(span.end));
                    }
                }
View Full Code Here

    private void updateSpanControl(Dictionary<String, Object> dictionary, String key) {
        BoxPane boxPane = (BoxPane)controls.get(key);

        if (boxPane != null) {
            Span span = (Span)dictionary.get(key);

            TextInput startTextInput = (TextInput)((FlowPane)boxPane.get(0)).get(0);
            TextInput endTextInput = (TextInput)((FlowPane)boxPane.get(1)).get(0);

            startTextInput.setText(span == null ? "" : String.valueOf(span.start));
View Full Code Here

TOP

Related Classes of org.apache.pivot.wtk.Span

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.