Examples of CalendarButton


Examples of org.apache.pivot.wtk.CalendarButton

        return preferredWidth;
    }

    @Override
    public int getPreferredHeight(int width) {
        CalendarButton calendarButton = (CalendarButton)getComponent();

        Button.DataRenderer dataRenderer = calendarButton.getDataRenderer();
        dataRenderer.render(calendarButton.getButtonData(), calendarButton, false);

        int preferredHeight = dataRenderer.getPreferredHeight(-1) + padding.top + padding.bottom
            + 2;

        return preferredHeight;
View Full Code Here

Examples of org.apache.pivot.wtk.CalendarButton

        return preferredHeight;
    }

    @Override
    public Dimensions getPreferredSize() {
        CalendarButton calendarButton = (CalendarButton)getComponent();

        Button.DataRenderer dataRenderer = calendarButton.getDataRenderer();
        dataRenderer.render(calendarButton.getButtonData(), calendarButton, false);

        Dimensions contentSize = dataRenderer.getPreferredSize();
        int preferredWidth = contentSize.width + TRIGGER_WIDTH + padding.left + padding.right + 2;
        int preferredHeight = contentSize.height + padding.top + padding.bottom + 2;
View Full Code Here

Examples of org.apache.pivot.wtk.CalendarButton

        return new Dimensions(preferredWidth, preferredHeight);
    }

    @Override
    public int getBaseline(int width, int height) {
        CalendarButton calendarButton = (CalendarButton)getComponent();

        Button.DataRenderer dataRenderer = calendarButton.getDataRenderer();
        dataRenderer.render(calendarButton.getButtonData(), calendarButton, false);

        int clientWidth = Math.max(width - (TRIGGER_WIDTH + padding.left + padding.right + 2), 0);
        int clientHeight = Math.max(height - (padding.top + padding.bottom + 2), 0);

        int baseline = dataRenderer.getBaseline(clientWidth, clientHeight);
View Full Code Here

Examples of org.apache.pivot.wtk.CalendarButton

        // No-op
    }

    @Override
    public void paint(Graphics2D graphics) {
        CalendarButton calendarButton = (CalendarButton)getComponent();

        int width = getWidth();
        int height = getHeight();

        Color backgroundColorLocal = null;
        Color bevelColorLocal = null;
        Color borderColorLocal = null;

        if (calendarButton.isEnabled()) {
            backgroundColorLocal = this.backgroundColor;
            bevelColorLocal = (pressed || (calendarPopup.isOpen() && !calendarPopup.isClosing())) ?
                pressedBevelColor : this.bevelColor;
            borderColorLocal = this.borderColor;
        } else {
            backgroundColorLocal = disabledBackgroundColor;
            bevelColorLocal = disabledBevelColor;
            borderColorLocal = disabledBorderColor;
        }

        // Paint the background
        graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
            RenderingHints.VALUE_ANTIALIAS_ON);

        graphics.setPaint(new GradientPaint(width / 2f, 0, bevelColorLocal, width / 2f, height / 2f,
            backgroundColorLocal));
        graphics.fill(new RoundRectangle2D.Double(0.5, 0.5, width - 1, height - 1, CORNER_RADIUS,
            CORNER_RADIUS));

        // Paint the content
        graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
            RenderingHints.VALUE_ANTIALIAS_OFF);

        Bounds contentBounds = new Bounds(0, 0, Math.max(width - TRIGGER_WIDTH - 1, 0), Math.max(
            height - 1, 0));
        Button.DataRenderer dataRenderer = calendarButton.getDataRenderer();
        dataRenderer.render(calendarButton.getButtonData(), calendarButton, false);
        dataRenderer.setSize(Math.max(contentBounds.width - (padding.left + padding.right + 2) + 1,
            0), Math.max(contentBounds.height - (padding.top + padding.bottom + 2) + 1, 0));

        Graphics2D contentGraphics = (Graphics2D)graphics.create();
        contentGraphics.translate(padding.left + 1, padding.top + 1);
        contentGraphics.clipRect(0, 0, dataRenderer.getWidth(), dataRenderer.getHeight());
        dataRenderer.paint(contentGraphics);
        contentGraphics.dispose();

        graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
            RenderingHints.VALUE_ANTIALIAS_ON);

        // Paint the border
        if (borderColorLocal != null) {
            graphics.setPaint(borderColorLocal);
            graphics.setStroke(new BasicStroke(1));
            graphics.draw(new RoundRectangle2D.Double(0.5, 0.5, width - 1, height - 1,
                CORNER_RADIUS, CORNER_RADIUS));
        }

        // Paint the focus state
        if (calendarButton.isFocused()) {
            BasicStroke dashStroke = new BasicStroke(1.0f, BasicStroke.CAP_ROUND,
                BasicStroke.JOIN_ROUND, 1.0f, new float[] { 0.0f, 2.0f }, 0.0f);
            graphics.setStroke(dashStroke);
            graphics.setColor(this.borderColor);
            graphics.draw(new RoundRectangle2D.Double(2.5, 2.5, Math.max(width - 5, 0), Math.max(
View Full Code Here

Examples of org.apache.pivot.wtk.CalendarButton

    public CalendarButtonSkin() {
        calendar = new Calendar();
        calendar.getCalendarListeners().add(new CalendarListener.Adapter() {
            @Override
            public void yearChanged(Calendar calendar, int previousYear) {
                CalendarButton calendarButton = (CalendarButton)getComponent();
                calendarButton.setYear(calendar.getYear());
            }

            @Override
            public void monthChanged(Calendar calendar, int previousMonth) {
                CalendarButton calendarButton = (CalendarButton)getComponent();
                calendarButton.setMonth(calendar.getMonth());
            }
        });

        calendarPopup = new Window();
        calendarPopup.getComponentMouseButtonListeners().add(calendarPopupMouseButtonListener);
View Full Code Here

Examples of org.apache.pivot.wtk.CalendarButton

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

        CalendarButton calendarButton = (CalendarButton)component;
        calendarButton.getCalendarButtonListeners().add(this);
        calendarButton.getCalendarButtonSelectionListeners().add(this);

        calendar.setLocale(calendarButton.getLocale());
    }
View Full Code Here

Examples of org.apache.pivot.wtk.CalendarButton

    private static Component addCalendarDateControl(final Dictionary<String, Object> dictionary,
        final String key, Form.Section section) {
        CalendarDate calendarDate = (CalendarDate)dictionary.get(key);

        CalendarButton calendarButton = new CalendarButton();
        calendarButton.setMinimumWidth(75);
        calendarButton.setSelectedDate(calendarDate);
        section.add(calendarButton);
        Form.setLabel(calendarButton, key);

        calendarButton.getCalendarButtonSelectionListeners().add
            (new CalendarButtonSelectionListener() {
            @Override
            public void selectedDateChanged(CalendarButton calendarButton,
                CalendarDate previousSelectedDate) {
                try {
                    dictionary.put(key, calendarButton.getSelectedDate());
                } catch (Exception exception) {
                    displayErrorMessage(exception, calendarButton.getWindow());
                    dictionary.put(key, previousSelectedDate);
                }
            }
        });
View Full Code Here

Examples of org.apache.pivot.wtk.CalendarButton

        return calendarButton;
    }

    private void updateCalendarDateControl(Dictionary<String, Object> dictionary, String key) {
        CalendarButton calendarButton = (CalendarButton)controls.get(key);

        if (calendarButton != null) {
            CalendarDate value = (CalendarDate)dictionary.get(key);
            calendarButton.setSelectedDate(value);
        }
    }
View Full Code Here

Examples of org.apache.pivot.wtk.CalendarButton

        ArrayList<String> al = new ArrayList<String>();
        al.add("One");
        al.add("Two");
        motif.setListData(al);

        CalendarButton cbDate = (CalendarButton)bxmlSerializer.getNamespace().get("date");
        dcl = (new DialogCloseListener() {
            public void dialogClosed(Dialog dialog, boolean modal) {
            }
        });
        cbDate.getCalendarButtonSelectionListeners().add(new CalendarButtonSelectionListener() {
            @Override
            public void selectedDateChanged(CalendarButton calendarButton, CalendarDate previousSelectedDate) {
            }
        });
View Full Code Here

Examples of org.apache.pivot.wtk.CalendarButton

        calendarPopup.getDecorators().add(dropShadowDecorator);
    }

    @Override
    public int getPreferredWidth(int height) {
        CalendarButton calendarButton = (CalendarButton)getComponent();

        Button.DataRenderer dataRenderer = calendarButton.getDataRenderer();
        dataRenderer.render(calendarButton.getButtonData(), calendarButton, false);

        int preferredWidth = dataRenderer.getPreferredWidth(-1) + TRIGGER_WIDTH + padding.left
            + padding.right + 2;

        return preferredWidth;
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.