Package org.apache.pivot.wtk

Examples of org.apache.pivot.wtk.ImageView$ImageViewBindingListenerList


        prompt.setContent(content);

        // Set the type image
        TerraTheme theme = (TerraTheme)Theme.getTheme();

        ImageView typeImageView = (ImageView)wtkxSerializer.get("typeImageView");
        typeImageView.setImage(theme.getMessageIcon(prompt.getMessageType()));

        // Set the message
        Label messageLabel = (Label)wtkxSerializer.get("messageLabel");
        String message = prompt.getMessage();
        messageLabel.setText(message);
View Full Code Here


        alert.setContent(content);

        // Set the type image
        TerraTheme theme = (TerraTheme)Theme.getTheme();

        ImageView typeImageView = (ImageView)wtkxSerializer.get("typeImageView");
        typeImageView.setImage(theme.getMessageIcon(alert.getMessageType()));

        // Set the message
        Label messageLabel = (Label)wtkxSerializer.get("messageLabel");
        String message = alert.getMessage();
        messageLabel.setText(message);
View Full Code Here

            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);
View Full Code Here

                    private Point offset = null;
                    private LocalManifest content = null;

                    @Override
                    public boolean beginDrag(Component component, int x, int y) {
                        ImageView imageView = (ImageView)component;
                        image = imageView.getImage();

                        if (image != null) {
                            imageView.setImage((Image)null);
                            content = new LocalManifest();
                            content.putImage(image);
                            offset = new Point(x - (imageView.getWidth() - image.getWidth()) / 2,
                                y - (imageView.getHeight() - image.getHeight()) / 2);
                        }

                        return (image != null);
                    }

                    @Override
                    public void endDrag(Component component, DropAction dropAction) {
                        if (dropAction == null) {
                            ImageView imageView = (ImageView)component;
                            imageView.setImage(image);
                        }

                        image = null;
                        offset = null;
                        content = null;
                    }

                    @Override
                    public boolean isNative() {
                        return false;
                    }

                    @Override
                    public LocalManifest getContent() {
                        return content;
                    }

                    @Override
                    public Visual getRepresentation() {
                        return image;
                    }

                    @Override
                    public Point getOffset() {
                        return offset;
                    }

                    @Override
                    public int getSupportedDropActions() {
                        return DropAction.MOVE.getMask();
                    }
                };

                DropTarget imageDropTarget = new DropTarget() {
                    @Override
                    public DropAction dragEnter(Component component, Manifest dragContent,
                        int supportedDropActions, DropAction userDropAction) {
                        DropAction dropAction = null;

                        ImageView imageView = (ImageView)component;
                        if (imageView.getImage() == null
                            && dragContent.containsImage()
                            && DropAction.MOVE.isSelected(supportedDropActions)) {
                            dropAction = DropAction.MOVE;
                            component.getStyles().put("backgroundColor", "#f0e68c");
                        }

                        return dropAction;
                    }

                    @Override
                    public void dragExit(Component component) {
                        component.getStyles().put("backgroundColor", null);
                    }

                    @Override
                    public DropAction dragMove(Component component, Manifest dragContent,
                        int supportedDropActions, int x, int y, DropAction userDropAction) {
                        ImageView imageView = (ImageView)component;
                        return (imageView.getImage() == null
                            && dragContent.containsImage() ? DropAction.MOVE : null);
                    }

                    @Override
                    public DropAction userDropActionChange(Component component, Manifest dragContent,
                        int supportedDropActions, int x, int y, DropAction userDropAction) {
                        ImageView imageView = (ImageView)component;
                        return (imageView.getImage() == null
                            && dragContent.containsImage() ? DropAction.MOVE : null);
                    }

                    @Override
                    public DropAction drop(Component component, Manifest dragContent,
                        int supportedDropActions, int x, int y, DropAction userDropAction) {
                        DropAction dropAction = null;

                        ImageView imageView = (ImageView)component;
                        if (imageView.getImage() == null
                            && dragContent.containsImage()) {
                            try {
                                imageView.setImage(dragContent.getImage());
                                dropAction = DropAction.MOVE;
                            } catch(IOException exception) {
                                System.err.println(exception);
                            }
                        }
View Full Code Here

            for (int fieldIndex = 0, fieldCount = section.getLength();
                fieldIndex < fieldCount; fieldIndex++) {
                Component field = section.get(fieldIndex);

                Label label = labels.get(sectionIndex).get(fieldIndex);
                ImageView flagImageView = flagImageViews.get(sectionIndex).get(fieldIndex);

                if (field.isVisible()) {
                    // Show the row components
                    label.setVisible(true);
                    flagImageView.setVisible(true);

                    // Determine the label size and baseline
                    Dimensions labelSize = label.getPreferredSize();
                    label.setSize(labelSize);
                    int labelAscent = label.getBaseline(labelSize.width, labelSize.height);
                    if (labelAscent == -1) {
                        labelAscent = labelSize.height;
                    }

                    int labelDescent = labelSize.height - labelAscent;

                    // Determine the field size and baseline
                    Dimensions fieldSize;
                    if (fill) {
                        fieldSize = new Dimensions(fieldWidth, field.getPreferredHeight(fieldWidth));
                    } else {
                        fieldSize = field.getPreferredSize();
                    }

                    field.setSize(fieldSize);

                    int fieldAscent = field.getBaseline(fieldSize.width, fieldSize.height);
                    if (fieldAscent == -1) {
                        fieldAscent = fieldSize.height;
                    }

                    int fieldDescent = fieldSize.height - fieldAscent;

                    // Determine the baseline and row height
                    int baseline = Math.max(labelAscent, fieldAscent);
                    int rowHeight = Math.max(baseline + Math.max(labelDescent, fieldDescent), FLAG_IMAGE_SIZE);

                    // Align the label and field to baseline
                    int labelX = rightAlignLabels ? maximumLabelWidth - label.getWidth() : 0;
                    int labelY = rowY + (baseline - labelAscent);
                    label.setLocation(labelX, labelY);

                    int fieldX = maximumLabelWidth + horizontalSpacing;
                    int fieldY = rowY + (baseline - fieldAscent);
                    field.setLocation(fieldX, fieldY);

                    // Vertically center the flag on the label
                    flagImageView.setSize(flagImageView.getPreferredSize());
                    int flagImageY = labelY + (labelSize.height - flagImageView.getHeight()) / 2;
                    flagImageView.setLocation(fieldX + field.getWidth() + flagImageOffset, flagImageY);

                    // Update the row y-coordinate
                    rowY += rowHeight + verticalSpacing;
                } else {
                    // Hide the row components
                    label.setVisible(false);
                    flagImageView.setVisible(false);
                }
            }
        }
    }
View Full Code Here

        labels.get(sectionIndex).insert(label, index);
        form.add(label);
        updateFieldLabel(section, index);

        // Create the flag image view
        ImageView flagImageView = new ImageView();
        flagImageViews.get(sectionIndex).insert(flagImageView, index);
        form.add(flagImageView);
        updateFieldFlag(section, index);

        invalidateComponent();
View Full Code Here

    private void updateFieldFlag(Form.Section section, int fieldIndex) {
        Form form = (Form)getComponent();
        Component field = section.get(fieldIndex);

        int sectionIndex = form.getSections().indexOf(section);
        ImageView flagImageView = flagImageViews.get(sectionIndex).get(fieldIndex);
        Form.Flag flag = Form.getFlag(field);

        Image flagImage = null;
        String flagMessage = null;

        if (flag != null) {
            TerraTheme theme = (TerraTheme) Theme.getTheme();
            MessageType flagMessageType = flag.getMessageType();
            flagImage = theme.getSmallMessageIcon(flagMessageType);
            flagMessage = flag.getMessage();
        }

        flagImageView.setImage(flagImage);
        flagImageView.setTooltipText(flagMessage);
    }
View Full Code Here

                    tableViewScrollPane.setScrollLeft(viewport.getScrollLeft());
                }
            }
        });

        cardPane.add(new ImageView(rowImage));
        cardPane.add(tablePane);
        cardPane.getCardPaneListeners().add(new CardPaneListener.Adapter() {
            @Override
            public void selectedIndexChanged(CardPane cardPaneArgument, int previousSelectedIndex) {
                if (previousSelectedIndex == IMAGE_CARD_INDEX) {
View Full Code Here

    @Override
    public void install(Component component) {
        super.install(component);

        ImageView imageView = (ImageView)component;
        imageView.getImageViewListeners().add(this);

        Image image = imageView.getImage();
        if (image != null) {
            image.getImageListeners().add(imageListener);
        }
    }
View Full Code Here

        }
    }

    @Override
    public int getPreferredWidth(int height) {
        ImageView imageView = (ImageView)getComponent();
        Image image = imageView.getImage();

        return (image == null) ? 0 : image.getWidth();
    }
View Full Code Here

TOP

Related Classes of org.apache.pivot.wtk.ImageView$ImageViewBindingListenerList

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.