<s> from pyjamas import Factory <EOL> from pyjamas import DOM <EOL> from pyjamas . ui . ComplexPanel import ComplexPanel <EOL> class AbsolutePanel ( ComplexPanel ) : <EOL> def __init__ ( self , ** ka ) : <EOL> element = ka . pop ( '<STR_LIT>' , None ) or DOM . createDiv ( ) <EOL> self . setElement ( element ) <EOL> DOM . setStyleAttribute ( element , "<STR_LIT>" , "<STR_LIT>" ) <EOL> DOM . setStyleAttribute ( element , "<STR_LIT>" , "<STR_LIT>" ) <EOL> ComplexPanel . __init__ ( self , ** ka ) <EOL> def add ( self , widget , left = None , top = None ) : <EOL> ComplexPanel . add ( self , widget , self . getElement ( ) ) <EOL> if left is not None : <EOL> self . setWidgetPosition ( widget , left , top ) <EOL> def setWidgetPosition ( self , widget , left , top ) : <EOL> self . checkWidgetParent ( widget ) <EOL> h = widget . getElement ( ) <EOL> if ( left == - <NUM_LIT:1> ) and ( top == - <NUM_LIT:1> ) : <EOL> DOM . setStyleAttribute ( h , "<STR_LIT:left>" , "<STR_LIT>" ) <EOL> DOM . setStyleAttribute ( h , "<STR_LIT>" , "<STR_LIT>" ) <EOL> DOM . setStyleAttribute ( h , "<STR_LIT>" , "<STR_LIT>" ) <EOL> else : <EOL> DOM . setStyleAttribute ( h , "<STR_LIT>" , "<STR_LIT>" ) <EOL> DOM . setStyleAttribute ( h , "<STR_LIT:left>" , "<STR_LIT>" % left ) <EOL> DOM . setStyleAttribute ( h , "<STR_LIT>" , "<STR_LIT>" % top ) <EOL> def getWidgetLeft ( self , widget ) : <EOL> self . checkWidgetParent ( widget ) <EOL> return DOM . getIntAttribute ( widget . getElement ( ) , "<STR_LIT>" ) <EOL> def getWidgetTop ( self , widget ) : <EOL> self . checkWidgetParent ( widget ) <EOL> return DOM . getIntAttribute ( widget . getElement ( ) , "<STR_LIT>" ) <EOL> def checkWidgetParent ( self , widget ) : <EOL> if widget . getParent ( ) != self : <EOL> raise Exception ( "<STR_LIT>" ) <EOL> Factory . registerClass ( '<STR_LIT>' , '<STR_LIT>' , AbsolutePanel ) </s>
