<s> from pyjamas . ui . Composite import Composite <EOL> from pyjamas . ui . HTML import HTML <EOL> from pyjamas . ui . HorizontalPanel import HorizontalPanel <EOL> from pyjamas . ui . Image import Image <EOL> from pyjamas . ui . PopupPanel import PopupPanel <EOL> from pyjamas . ui . VerticalPanel import VerticalPanel <EOL> from pyjamas . ui . Widget import Widget <EOL> from pyjamas . ui . Label import Label <EOL> from MailLogger import Logger <EOL> class Contact : <EOL> def __init__ ( self , name , email ) : <EOL> self . photo = "<STR_LIT>" <EOL> self . name = name <EOL> self . email = email <EOL> class ContactPopup ( PopupPanel ) : <EOL> def __init__ ( self , contact ) : <EOL> PopupPanel . __init__ ( self , True ) <EOL> inner = VerticalPanel ( ) <EOL> nameLabel = Label ( contact . name ) <EOL> emailLabel = Label ( contact . email ) <EOL> inner . add ( nameLabel ) <EOL> inner . add ( emailLabel ) <EOL> panel = HorizontalPanel ( ) <EOL> panel . setSpacing ( <NUM_LIT:4> ) <EOL> panel . add ( Image ( contact . photo ) ) <EOL> panel . add ( inner ) <EOL> self . add ( panel ) <EOL> self . setStyleName ( "<STR_LIT>" ) <EOL> nameLabel . setStyleName ( "<STR_LIT>" ) <EOL> emailLabel . setStyleName ( "<STR_LIT>" ) <EOL> class Contacts ( Composite ) : <EOL> def __init__ ( self ) : <EOL> Composite . __init__ ( self ) <EOL> self . contacts = [ ] <EOL> self . contacts . append ( Contact ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> self . contacts . append ( Contact ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> self . contacts . append ( Contact ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> self . contacts . append ( Contact ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> self . contacts . append ( Contact ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> self . contacts . append ( Contact ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> self . contacts . append ( Contact ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> self . contacts . append ( Contact ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> self . panel = VerticalPanel ( ) <EOL> i = <NUM_LIT:0> <EOL> while ( i < len ( self . contacts ) ) : <EOL> self . addContact ( self . contacts [ i ] ) <EOL> i = i + <NUM_LIT:1> <EOL> self . initWidget ( self . panel ) <EOL> self . setStyleName ( "<STR_LIT>" ) <EOL> def addContact ( self , contact ) : <EOL> link = HTML ( "<STR_LIT>" + contact . name + "<STR_LIT>" ) <EOL> self . panel . add ( link ) <EOL> listener = ContactListener ( contact , link ) <EOL> link . addClickListener ( listener ) <EOL> class ContactListener : <EOL> def __init__ ( self , contact , link ) : <EOL> self . cont = contact <EOL> self . link = link <EOL> def onClick ( self , sender ) : <EOL> if ( sender == self . link ) : <EOL> popup = ContactPopup ( self . cont ) <EOL> left = self . link . getAbsoluteLeft ( ) + <NUM_LIT:32> <EOL> top = self . link . getAbsoluteTop ( ) + <NUM_LIT:8> <EOL> popup . setPopupPosition ( left , top ) <EOL> popup . show ( ) </s>
