de.enough.polish.ui.clockviews
Class BinaryTextClockView

java.lang.Object
  extended by de.enough.polish.ui.ItemView
      extended by de.enough.polish.ui.clockviews.BinaryTextClockView
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
HexTextClockView

public class BinaryTextClockView
extends ItemView

Visualizes the clock as a binary string, e.g. 101:111 instead of 4:11.

Copyright Enough Software 2007 - 2008

 history
        May 30, 2007 - rob creation
 

Author:
Robert Virkus, j2mepolish@enough.de

Field Summary
protected  java.util.Calendar calendar
           
protected  ClockItem clockItem
           
protected  StringItem clockText
           
protected  java.util.Date date
           
protected  long lastTimeUpdate
           
 
Fields inherited from class de.enough.polish.ui.ItemView
contentHeight, contentWidth, isFocused, isLayoutCenter, isLayoutRight, layout, paddingHorizontal, paddingVertical, parentItem
 
Constructor Summary
BinaryTextClockView()
          Creates a new item view.
 
Method Summary
 boolean animate()
          Animates this view - please use animate(long, ClippingRegion) instead, if possible
protected  void initContent(Item parent, int firstLineWidth, int lineWidth)
          Initialises this item view.
protected  boolean isValid(Item parent, Style style)
          Implementation that are valid only for specific item classes can override this method so that they cannot be accidently attached to unsupported classes.
protected  void paintContent(Item parent, int x, int y, int leftBorder, int rightBorder, javax.microedition.lcdui.Graphics g)
          Paints this item view.
protected  void setStyle(Style style)
          Sets the style for this view.
protected  java.lang.String updateTime(long time)
          Updates the shown time.
 
Methods inherited from class de.enough.polish.ui.ItemView
addFullRepaintRegion, animate, defocus, focus, getScreen, handleKeyPressed, handleKeyReleased, handlePointerPressed, handlePointerReleased, hideNotify, initContentByParent, notifyItemPressedEnd, notifyItemPressedStart, paintBackground, paintBorder, paintContentByParent, releaseResources, removeItemBackground, removeItemBorder, removeParentBackground, removeParentBorder, removeViewFromParent, requestInit, showNotify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

date

protected final transient java.util.Date date

calendar

protected final transient java.util.Calendar calendar

clockText

protected final transient StringItem clockText

lastTimeUpdate

protected transient long lastTimeUpdate

clockItem

protected transient ClockItem clockItem
Constructor Detail

BinaryTextClockView

public BinaryTextClockView()
Creates a new item view.

Method Detail

animate

public boolean animate()
Description copied from class: ItemView
Animates this view - please use animate(long, ClippingRegion) instead, if possible

Overrides:
animate in class ItemView
Returns:
true when the view was actually animated.
See Also:
ItemView.animate(long, ClippingRegion)

initContent

protected void initContent(Item parent,
                           int firstLineWidth,
                           int lineWidth)
Description copied from class: ItemView
Initialises this item view. The implementation needs to calculate and set the contentWidth and contentHeight fields. The implementation should take the fields preferredWidth and preferredHeight into account.

Specified by:
initContent in class ItemView
Parameters:
parent - the parent item
firstLineWidth - the maximum width of the first line
lineWidth - the maximum width of any following lines
See Also:
ItemView.contentWidth, ItemView.contentHeight

updateTime

protected java.lang.String updateTime(long time)
Updates the shown time.

Parameters:
time - the currently shown time
Returns:
the time as a binary string

paintContent

protected void paintContent(Item parent,
                            int x,
                            int y,
                            int leftBorder,
                            int rightBorder,
                            javax.microedition.lcdui.Graphics g)
Description copied from class: ItemView
Paints this item view.

Specified by:
paintContent in class ItemView
Parameters:
parent - the parent item
x - the left start position
y - the upper start position
leftBorder - the left border, nothing must be painted left of this position
rightBorder - the right border, nothing must be painted right of this position
g - the Graphics on which this item should be painted.

isValid

protected boolean isValid(Item parent,
                          Style style)
Description copied from class: ItemView
Implementation that are valid only for specific item classes can override this method so that they cannot be accidently attached to unsupported classes. This allows casting without checking the parent item with instanceof in each method, for example. The default implementation just returns true for any case.

Overrides:
isValid in class ItemView
Parameters:
parent - the parent item
style - the style
Returns:
true when the view can be used for the parent item.

setStyle

protected void setStyle(Style style)
Description copied from class: ItemView
Sets the style for this view. The style can include additional parameters for the view. Subclasses should call super.setStyle(style) first.

Overrides:
setStyle in class ItemView
Parameters:
style - the style