Class BasicMonthViewUI
- java.lang.Object
-
- javax.swing.plaf.ComponentUI
-
- org.jdesktop.swingx.plaf.MonthViewUI
-
- org.jdesktop.swingx.plaf.basic.BasicMonthViewUI
-
- Direct Known Subclasses:
- DemoMonthViewUI
public class BasicMonthViewUI extends MonthViewUI
Base implementation of theJXMonthViewUI.Note: The api changed considerably between releases 0.9.4 and 0.9.5.
The general drift of the change was to delegate all text rendering to a dedicated rendering controller (currently named RenderingHandler), similar to the collection view rendering. The UI itself keeps layout and positioning of the rendering components. Plus updating on property changes received from the monthView.
Painting: coordinate systems.
- Screen coordinates of months/days, accessible via the getXXBounds() methods. These coordinates are absolute in the system of the monthView.
- The grid of visible months with logical row/column coordinates. The logical coordinates are adjusted to ComponentOrientation.
- The grid of days in a month with logical row/column coordinates. The logical coordinates are adjusted to ComponentOrientation. The columns are the (optional) week header and the days of the week. The rows are the day header and the weeks in a month. The day header shows the localized names of the days and has the row coordinate DAY_HEADER_ROW. It is shown always. The row header shows the week number in the year and has the column coordinate WEEK_HEADER_COLUMN. It is shown only if the showingWeekNumber property is true.
Added support (doesn't do anything yet, zoom-logic must yet be defined) by way of an active calendar header which is added to the monthView if zoomable. It is disabled by default. In this mode, the view is always traversable and shows exactly one calendar. It is orthogonal to the classic mode, that is client code should not be effected in any way as long as the mode is not explicitly enabled.
NOTE to LAF implementors: the active calendar header is very, very, very raw and sure to change without much notice. Better not yet to support it right now.
-
-
Field Summary
Fields Modifier and Type Field and Description static intMONTH_DOWNReturn value used to identify when the month down button is pressed.static intMONTH_UPReturn value used to identify when the month up button is pressed.
-
Constructor Summary
Constructors Constructor and Description BasicMonthViewUI()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static javax.swing.plaf.ComponentUIcreateUI(javax.swing.JComponent c)java.util.DategetDayAtLocation(int x, int y)Returns the Date at the given location.java.lang.String[]getDaysOfTheWeek()Returns an array of String to use as names for the days of the week.java.util.DategetLastDisplayedDay()Returns the last possible date that can be displayed.voidinstallUI(javax.swing.JComponent c)Installs the component as appropriate for the current lf.booleanisUsingKeyboard()voidpaint(java.awt.Graphics g, javax.swing.JComponent c)voidsetUsingKeyboard(boolean val)voiduninstallUI(javax.swing.JComponent c)voidupdate(java.awt.Graphics g, javax.swing.JComponent c)Overridden to extract the background painting for ease-of-use of subclasses.
-
-
-
Field Detail
-
MONTH_DOWN
public static final int MONTH_DOWN
Return value used to identify when the month down button is pressed.- See Also:
- Constant Field Values
-
MONTH_UP
public static final int MONTH_UP
Return value used to identify when the month up button is pressed.- See Also:
- Constant Field Values
-
-
Method Detail
-
createUI
public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
-
installUI
public void installUI(javax.swing.JComponent c)
Installs the component as appropriate for the current lf. PENDING JW: clarify sequence of installXX methods.- Overrides:
installUIin classjavax.swing.plaf.ComponentUI
-
uninstallUI
public void uninstallUI(javax.swing.JComponent c)
- Overrides:
uninstallUIin classjavax.swing.plaf.ComponentUI
-
getDaysOfTheWeek
public java.lang.String[] getDaysOfTheWeek()
Description copied from class:MonthViewUIReturns an array of String to use as names for the days of the week.- Specified by:
getDaysOfTheWeekin classMonthViewUI- Returns:
- array of names for the days of the week.
-
isUsingKeyboard
public boolean isUsingKeyboard()
-
setUsingKeyboard
public void setUsingKeyboard(boolean val)
-
getDayAtLocation
public java.util.Date getDayAtLocation(int x, int y)Returns the Date at the given location. May be null if the coordinates don't map to a day in the month which contains the coordinates. Specifically: hitting leading/trailing dates returns null. Mapping pixel to calendar day.- Specified by:
getDayAtLocationin classMonthViewUI- Parameters:
x- the x position of the location in pixely- the y position of the location in pixel- Returns:
- the day at the given location or null if the location doesn't map to a day in the month which contains the coordinates.
- See Also:
getDayBounds(Date)
-
update
public void update(java.awt.Graphics g, javax.swing.JComponent c)Overridden to extract the background painting for ease-of-use of subclasses.- Overrides:
updatein classjavax.swing.plaf.ComponentUI
-
paint
public void paint(java.awt.Graphics g, javax.swing.JComponent c)- Overrides:
paintin classjavax.swing.plaf.ComponentUI
-
getLastDisplayedDay
public java.util.Date getLastDisplayedDay()
Returns the last possible date that can be displayed. This is implemented by the UI since it is in control of layout and may possibly yeild different results based on implementation.It's up to the UI to keep this property, based on internal state and the firstDisplayed as controlled by the JXMonthView.
- Specified by:
getLastDisplayedDayin classMonthViewUI- Returns:
- Date The date.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG