<s> import pyjd <EOL> from pyjamas . ui . TabBar import TabBar <EOL> from pyjamas . ui . TabPanel import TabPanel <EOL> from pyjamas . ui import HasAlignment <EOL> from pyjamas . ui . Image import Image <EOL> from pyjamas . ui . VerticalPanel import VerticalPanel <EOL> from pyjamas . ui . RootPanel import RootPanel <EOL> from pyjamas . ui . HorizontalPanel import HorizontalPanel <EOL> from pyjamas . ui . HTML import HTML <EOL> from pyjamas . ui . Composite import Composite <EOL> from pyjamas . ui import MouseListener <EOL> from pyjamas . ui import Event <EOL> from pyjamas import Window <EOL> from pyjamas . ui . DecoratorPanel import DecoratedTabPanel , DecoratorPanel <EOL> from pyjamas . ui . DecoratorPanel import DecoratorTitledPanel <EOL> class PrettyTab ( Composite ) : <EOL> def __init__ ( self , text , imageUrl ) : <EOL> DecoratorPanel . __init__ ( self , DecoratorPanel . DECORATE_ALL ) <EOL> p = HorizontalPanel ( ) <EOL> p . setSpacing ( <NUM_LIT:3> ) <EOL> self . img = Image ( imageUrl ) <EOL> self . txt = HTML ( text ) <EOL> p . add ( self . img ) <EOL> p . add ( self . txt ) <EOL> self . add ( p ) <EOL> def addClickListener ( self , listener ) : <EOL> self . img . addClickListener ( listener ) <EOL> self . txt . addClickListener ( listener ) <EOL> class Tabs : <EOL> def onModuleLoad ( self ) : <EOL> red = "<STR_LIT>" <EOL> green = "<STR_LIT>" <EOL> self . fTabs = DecoratedTabPanel ( Size = ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> self . fTabs . add ( self . createImage ( "<STR_LIT>" ) , <EOL> red , True , name = "<STR_LIT>" ) <EOL> self . fTabs . add ( self . createImage ( "<STR_LIT>" ) , <EOL> green , True , name = "<STR_LIT>" ) <EOL> self . fTabs . add ( self . createImage ( "<STR_LIT>" ) , <EOL> "<STR_LIT>" , name = "<STR_LIT>" ) <EOL> self . fTabs . add ( self . createImage ( <EOL> "<STR_LIT>" ) , "<STR_LIT>" , <EOL> "<STR_LIT>" ) <EOL> self . fTabs . add ( HTML ( "<STR_LIT>" ) , None ) <EOL> self . fTabs . add ( HTML ( "<STR_LIT>" ) , <EOL> "<STR_LIT>" , "<STR_LIT:test>" ) <EOL> self . fTabs . selectTab ( <NUM_LIT:0> ) <EOL> dp = DecoratorTitledPanel ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> dp . add ( self . fTabs ) <EOL> RootPanel ( ) . add ( dp ) <EOL> self . fTabs . addTabListener ( self ) <EOL> def createImage ( self , imageUrl ) : <EOL> image = Image ( imageUrl ) <EOL> image . setStyleName ( "<STR_LIT>" ) <EOL> p = VerticalPanel ( ) <EOL> p . setHorizontalAlignment ( HasAlignment . ALIGN_CENTER ) <EOL> p . setVerticalAlignment ( HasAlignment . ALIGN_MIDDLE ) <EOL> p . add ( image ) <EOL> return p <EOL> def onTabSelected ( self , sender , tabIndex ) : <EOL> pass <EOL> def onBeforeTabSelected ( self , sender , tabIndex ) : <EOL> if self . fTabs . getWidgetCount ( ) == <NUM_LIT:6> : <EOL> self . fTabs . add ( HTML ( "<STR_LIT>" ) , <EOL> "<STR_LIT>" , name = "<STR_LIT>" ) <EOL> return True <EOL> self . fTabs . remove ( "<STR_LIT>" ) <EOL> return tabIndex != <NUM_LIT:6> <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> pyjd . setup ( "<STR_LIT>" ) <EOL> app = Tabs ( ) <EOL> app . onModuleLoad ( ) <EOL> pyjd . run ( ) </s>
