Search in sources :

Example 11 with CalendarButton

use of org.apache.pivot.wtk.CalendarButton in project pivot by apache.

the class TerraCalendarButtonSkin method getPreferredSize.

@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 + paddingWidth();
    int preferredHeight = contentSize.height + paddingHeight();
    return new Dimensions(preferredWidth, preferredHeight);
}
Also used : CalendarButton(org.apache.pivot.wtk.CalendarButton) Button(org.apache.pivot.wtk.Button) CalendarButton(org.apache.pivot.wtk.CalendarButton) Dimensions(org.apache.pivot.wtk.Dimensions) Point(org.apache.pivot.wtk.Point) GradientPaint(java.awt.GradientPaint)

Example 12 with CalendarButton

use of org.apache.pivot.wtk.CalendarButton in project pivot by apache.

the class TerraCalendarButtonSkin method getBaseline.

@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 - paddingWidth(), 0);
    int clientHeight = Math.max(height - paddingHeight(), 0);
    int baseline = dataRenderer.getBaseline(clientWidth, clientHeight);
    if (baseline != -1) {
        baseline += padding.top + 1;
    }
    return baseline;
}
Also used : CalendarButton(org.apache.pivot.wtk.CalendarButton) Button(org.apache.pivot.wtk.Button) CalendarButton(org.apache.pivot.wtk.CalendarButton) Point(org.apache.pivot.wtk.Point) GradientPaint(java.awt.GradientPaint)

Aggregations

CalendarButton (org.apache.pivot.wtk.CalendarButton)12 Button (org.apache.pivot.wtk.Button)6 GradientPaint (java.awt.GradientPaint)5 CalendarDate (org.apache.pivot.util.CalendarDate)5 Point (org.apache.pivot.wtk.Point)5 BXMLSerializer (org.apache.pivot.beans.BXMLSerializer)2 CalendarButtonSelectionListener (org.apache.pivot.wtk.CalendarButtonSelectionListener)2 ListButton (org.apache.pivot.wtk.ListButton)2 BasicStroke (java.awt.BasicStroke)1 Color (java.awt.Color)1 Graphics2D (java.awt.Graphics2D)1 GeneralPath (java.awt.geom.GeneralPath)1 RoundRectangle2D (java.awt.geom.RoundRectangle2D)1 IOException (java.io.IOException)1 DateFormat (java.text.DateFormat)1 Date (java.util.Date)1 Locale (java.util.Locale)1 ArrayList (org.apache.pivot.collections.ArrayList)1 SerializationException (org.apache.pivot.serialization.SerializationException)1 Filter (org.apache.pivot.util.Filter)1