Examples of FlowPane


Examples of org.apache.pivot.wtk.FlowPane

        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 textInputLocal = (TextInput)component;
                    Span spanLocal = (Span)dictionary.get(key);

                    try {
                        int start = Integer.parseInt(textInputLocal.getText());
                        dictionary.put(key, new Span(start, spanLocal == null ? start : spanLocal.end));
                    } catch (Exception exception) {
                        displayErrorMessage(exception, component.getWindow());
                        textInputLocal.setText(spanLocal == null ? "" : String.valueOf(spanLocal.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 textInputLocal = (TextInput)component;
                    Span spanLocal = (Span)dictionary.get(key);

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

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

        return boxPane;
    }
View Full Code Here

Examples of org.apache.pivot.wtk.FlowPane

        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(4);
        textInput.setMaximumLength(4);
        textInput.setValidator(new IntValidator());
        textInput.setText(String.valueOf(cornerRadii.topLeft));
        flowPane.add(textInput);

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

                    try {
                        int topLeft = Integer.parseInt(textInputLocal.getText());
                        dictionary.put(key, new CornerRadii(topLeft, cornerRadiiLocal.topRight,
                            cornerRadiiLocal.bottomLeft, cornerRadiiLocal.bottomRight));
                    } catch (Exception exception) {
                        displayErrorMessage(exception, component.getWindow());
                        textInputLocal.setText(String.valueOf(cornerRadiiLocal.topLeft));
                    }
                }
            }
        });

        Label label = new Label("topLeft");
        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(4);
        textInput.setMaximumLength(4);
        textInput.setValidator(new IntValidator());
        textInput.setText(String.valueOf(cornerRadii.topRight));
        flowPane.add(textInput);

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

                    try {
                        int topRight = Integer.parseInt(textInputLocal.getText());
                        dictionary.put(key, new CornerRadii(cornerRadiiLocal.topLeft, topRight,
                            cornerRadiiLocal.bottomLeft, cornerRadiiLocal.bottomRight));
                    } catch (Exception exception) {
                        displayErrorMessage(exception, component.getWindow());
                        textInputLocal.setText(String.valueOf(cornerRadiiLocal.topRight));
                    }
                }
            }
        });

        label = new Label("topRight");
        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(4);
        textInput.setMaximumLength(4);
        textInput.setValidator(new IntValidator());
        textInput.setText(String.valueOf(cornerRadii.bottomLeft));
        flowPane.add(textInput);

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

                    try {
                        int bottomLeft = Integer.parseInt(textInputLocal.getText());
                        dictionary.put(key, new CornerRadii(cornerRadiiLocal.topLeft,
                            cornerRadiiLocal.topRight, bottomLeft, cornerRadiiLocal.bottomRight));
                    } catch (Exception exception) {
                        displayErrorMessage(exception, component.getWindow());
                        textInputLocal.setText(String.valueOf(cornerRadiiLocal.bottomLeft));
                    }
                }
            }
        });

        label = new Label("bottomLeft");
        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(4);
        textInput.setMaximumLength(4);
        textInput.setValidator(new IntValidator());
        textInput.setText(String.valueOf(cornerRadii.bottomRight));
        flowPane.add(textInput);

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

                    try {
                        int bottomRight = Integer.parseInt(textInputLocal.getText());
                        dictionary.put(key, new CornerRadii(cornerRadiiLocal.topLeft,
                            cornerRadiiLocal.topRight, cornerRadiiLocal.bottomLeft, bottomRight));
                    } catch (Exception exception) {
                        displayErrorMessage(exception, component.getWindow());
                        textInputLocal.setText(String.valueOf(cornerRadiiLocal.bottomRight));
                    }
                }
            }
        });

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

        return boxPane;
    }
View Full Code Here

Examples of org.apache.pivot.wtk.FlowPane

        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(scope == null ? "" : String.valueOf(scope.start));
        flowPane.add(textInput);

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

                    try {
                        int start = Integer.parseInt(textInputLocal.getText());
                        dictionary.put(key, new Scope(start, scopeLocal == null ? start : scopeLocal.end,
                            scopeLocal == null ? start : scopeLocal.extent));
                    } catch (Exception exception) {
                        displayErrorMessage(exception, component.getWindow());
                        textInputLocal.setText(scopeLocal == null ? "" : String.valueOf(scopeLocal.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(scope == null ? "" : String.valueOf(scope.end));
        flowPane.add(textInput);

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

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

        label = new Label("end");
        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(scope == null ? "" : String.valueOf(scope.extent));
        flowPane.add(textInput);

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

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

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

        return boxPane;
    }
View Full Code Here

Examples of org.apache.pivot.wtk.FlowPane

        alignToBaseline = true;
    }

    @Override
    public int getPreferredWidth(int height) {
        FlowPane flowPane = (FlowPane)getComponent();

        int preferredWidth = 0;

        // Preferred width is the sum of the preferred widths of all components
        // (height constraint is ignored)
        int j = 0;
        for (int i = 0, n = flowPane.getLength(); i < n; i++) {
            Component component = flowPane.get(i);

            if (component.isVisible()) {
                preferredWidth += component.getPreferredWidth();
                j++;
            }
View Full Code Here

Examples of org.apache.pivot.wtk.FlowPane

        return preferredWidth;
    }

    @Override
    public int getPreferredHeight(int width) {
        FlowPane flowPane = (FlowPane)getComponent();

        int preferredHeight;

        if (width == -1) {
            if (alignToBaseline) {
                // Delegate to preferred size calculations
                Dimensions preferredSize = getPreferredSize();
                preferredHeight = preferredSize.height;
            } else {
                // Preferred height is the maximum preferred height of all components
                preferredHeight = 0;

                for (int i = 0, n = flowPane.getLength(); i < n; i++) {
                    Component component = flowPane.get(i);

                    if (component.isVisible()) {
                        preferredHeight = Math.max(preferredHeight, component.getPreferredHeight());
                    }
                }
            }
        } else {
            // Break the components into multiple rows
            preferredHeight = 0;

            int contentWidth = Math.max(width - (padding.left + padding.right), 0);

            int rowCount = 0;

            int rowWidth = 0;
            int rowAscent = 0;
            int rowDescent = 0;

            for (int i = 0, n = flowPane.getLength(); i < n; i++) {
                Component component = flowPane.get(i);

                if (component.isVisible()) {
                    Dimensions size = component.getPreferredSize();

                    if (rowWidth + size.width > contentWidth
View Full Code Here

Examples of org.apache.pivot.wtk.FlowPane

        return preferredHeight;
    }

    @Override
    public Dimensions getPreferredSize() {
        FlowPane flowPane = (FlowPane)getComponent();

        int preferredWidth = 0;

        int ascent = 0;
        int descent = 0;

        int j = 0;
        for (int i = 0, n = flowPane.getLength(); i < n; i++) {
            Component component = flowPane.get(i);

            if (component.isVisible()) {
                Dimensions size = component.getPreferredSize();
                preferredWidth += size.width;
View Full Code Here

Examples of org.apache.pivot.wtk.FlowPane

            + padding.top + padding.bottom);
    }

    @Override
    public int getBaseline(int width, int height) {
        FlowPane flowPane = (FlowPane)getComponent();

        int baseline = -1;

        if (alignToBaseline) {
            int contentWidth = Math.max(width - (padding.left + padding.right), 0);

            // Break the components into multiple rows, and calculate the baseline of the
            // first row
            int rowWidth = 0;
            for (int i = 0, n = flowPane.getLength(); i < n; i++) {
                Component component = flowPane.get(i);

                if (component.isVisible()) {
                    Dimensions size = component.getPreferredSize();

                    if (rowWidth + size.width > contentWidth
View Full Code Here

Examples of org.apache.pivot.wtk.FlowPane

        return baseline;
    }

    @Override
    public void layout() {
        FlowPane flowPane = (FlowPane)getComponent();
        int width = getWidth();
        int contentWidth = Math.max(width - (padding.left + padding.right), 0);

        // Break the components into multiple rows
        ArrayList<ArrayList<Component>> rows = new ArrayList<ArrayList<Component>>();

        ArrayList<Component> row = new ArrayList<Component>();
        int rowWidth = 0;

        for (int i = 0, n = flowPane.getLength(); i < n; i++) {
            Component component = flowPane.get(i);

            if (component.isVisible()) {
                Dimensions componentSize = component.getPreferredSize();
                component.setSize(componentSize);
View Full Code Here

Examples of org.apache.pivot.wtk.FlowPane

        alignToBaseline = true;
    }

    @Override
    public int getPreferredWidth(int height) {
        FlowPane flowPane = (FlowPane)getComponent();

        int preferredWidth = 0;

        // Preferred width is the sum of the preferred widths of all components
        // (height constraint is ignored)
        int j = 0;
        for (int i = 0, n = flowPane.getLength(); i < n; i++) {
            Component component = flowPane.get(i);

            if (component.isVisible()) {
                preferredWidth += component.getPreferredWidth();
                j++;
            }
View Full Code Here

Examples of org.apache.pivot.wtk.FlowPane

        return preferredWidth;
    }

    @Override
    public int getPreferredHeight(int width) {
        FlowPane flowPane = (FlowPane)getComponent();

        int preferredHeight;

        if (width == -1) {
            if (alignToBaseline) {
                // Delegate to preferred size calculations
                Dimensions preferredSize = getPreferredSize();
                preferredHeight = preferredSize.height;
            } else {
                // Preferred height is the maximum preferred height of all components
                preferredHeight = 0;

                for (int i = 0, n = flowPane.getLength(); i < n; i++) {
                    Component component = flowPane.get(i);

                    if (component.isVisible()) {
                        preferredHeight = Math.max(preferredHeight, component.getPreferredHeight());
                    }
                }
            }
        } else {
            // Break the components into multiple rows
            preferredHeight = 0;

            int contentWidth = Math.max(width - (padding.left + padding.right), 0);

            int rowCount = 0;

            int rowWidth = 0;
            int rowAscent = 0;
            int rowDescent = 0;

            for (int i = 0, n = flowPane.getLength(); i < n; i++) {
                Component component = flowPane.get(i);

                if (component.isVisible()) {
                    Dimensions size = component.getPreferredSize();

                    if (rowWidth + size.width > contentWidth
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.