class ShowCaseApp(object): def onModuleLoad(self): self.tabs = TabPanel() tab_overview=TabContainer() self.tabs.add(tab_overview, 'Overview') self.tab_events=TabRaphaelContainer() self.tab_events.set_headline('Events Example') self.tab_events.set_raphael(events.Events(width=600,height=300)) self.tab_events.set_status('Execute events on Raphael Elemnts') self.tabs.add(self.tab_events, 'Events') self.tab_graffle=TabRaphaelContainer() self.tab_graffle.set_headline('This is a simple example of the Raphael Graffle') self.tab_graffle.set_raphael(graffle.Graffle(width=600,height=300)) self.tabs.add(self.tab_graffle, 'Graffle') self.tab_spinner=TabRaphaelContainer() self.tab_spinner.set_headline('This Raphael Spinner Example') self.tab_spinner.set_raphael(spinner.Spinner(width=600,height=300)) self.tabs.add(self.tab_spinner, 'Spinner') self.tabs.selectTab(0) self.tabs.setWidth("100%") self.tabs.setHeight("100%") RootPanel().add(self.tabs) def draw(self): self.tab_spinner.raphael.draw() self.tab_graffle.raphael.draw()
class ShowCaseApp(object): def onModuleLoad(self): self.tabs = TabPanel() tab_overview = TabContainer() self.tabs.add(tab_overview, 'Overview') self.tab_events = TabRaphaelContainer() self.tab_events.set_headline('Events Example') self.tab_events.set_raphael(events.Events(width=600, height=300)) self.tab_events.set_status('Execute events on Raphael Elemnts') self.tabs.add(self.tab_events, 'Events') self.tab_graffle = TabRaphaelContainer() self.tab_graffle.set_headline( 'This is a simple example of the Raphael Graffle') self.tab_graffle.set_raphael(graffle.Graffle(width=600, height=300)) self.tabs.add(self.tab_graffle, 'Graffle') self.tab_spinner = TabRaphaelContainer() self.tab_spinner.set_headline('This Raphael Spinner Example') self.tab_spinner.set_raphael(spinner.Spinner(width=600, height=300)) self.tabs.add(self.tab_spinner, 'Spinner') self.tabs.selectTab(0) self.tabs.setWidth("100%") self.tabs.setHeight("100%") RootPanel().add(self.tabs) def draw(self): self.tab_spinner.raphael.draw() self.tab_graffle.raphael.draw()
class Tabs(Sink): def __init__(self): Sink.__init__(self) self.fTabs = TabPanel() self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/JohannesElison.jpg"), "1634") self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/SelfPortrait1640.jpg"), "1640") self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/LaMarcheNocturne.jpg"), "1642") self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/TheReturnOfTheProdigalSon.jpg"), "1662") self.fTabs.selectTab(0) self.fTabs.setWidth("100%") self.fTabs.setHeight("100%") self.initWidget(self.fTabs) def onShow(self): pass def createImage(self, imageUrl): image = Image(imageUrl) image.setStyleName("ks-images-Image") p = VerticalPanel() p.setHorizontalAlignment(HasAlignment.ALIGN_CENTER) p.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE) p.add(image) return p
class Tabs(Sink): def __init__(self): Sink.__init__(self) self.fTabs = TabPanel() self.fTabs.addTabListener(self) self.fTabs.add( self.createImage(self.baseURL() + "rembrandt/JohannesElison.jpg"), "1634") self.fTabs.add( self.createImage(self.baseURL() + "rembrandt/SelfPortrait1640.jpg"), "1640") self.fTabs.add( self.createImage(self.baseURL() + "rembrandt/LaMarcheNocturne.jpg"), "1642") self.fTabs.add( self.createImage(self.baseURL() + "rembrandt/TheReturnOfTheProdigalSon.jpg"), "1662") self.fTabs.add( self.createImage(self.baseURL() + "rembrandt/TheReturnOfTheProdigalSon.jpg"), "1662 (disabled)") self.fTabs.selectTab(0) self.fTabs.setWidth("100%") self.fTabs.setHeight("100%") self.initWidget(self.fTabs) def onShow(self): pass def createImage(self, imageUrl): image = Image(imageUrl) image.setStyleName("ks-images-Image") p = VerticalPanel() p.setHorizontalAlignment(HasAlignment.ALIGN_CENTER) p.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE) p.add(image) return p def onBeforeTabSelected(self, sender, tabIndex): # Returning False disables the tab. if tabIndex == 4: return False return True def onTabSelected(self, sender, tabIndex): bar = self.fTabs.getTabBar() if tabIndex == 0: bar.getTabWidget(0).setText('1634 (selected)') else: bar.getTabWidget(0).setText('1634 (not selected)')
class Tabs(Sink): def __init__(self): Sink.__init__(self) self.fTabs = TabPanel() self.fTabs.addTabListener(self) self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/JohannesElison.jpg"), "1634") self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/SelfPortrait1640.jpg"), "1640") self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/LaMarcheNocturne.jpg"), "1642") self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/TheReturnOfTheProdigalSon.jpg"), "1662") self.fTabs.add(self.createImage(self.baseURL() + "rembrandt/TheReturnOfTheProdigalSon.jpg"), "1662 (disabled)") self.fTabs.selectTab(0) self.fTabs.setWidth("100%") self.fTabs.setHeight("100%") self.initWidget(self.fTabs) def onShow(self): pass def createImage(self, imageUrl): image = Image(imageUrl) image.setStyleName("ks-images-Image") p = VerticalPanel() p.setHorizontalAlignment(HasAlignment.ALIGN_CENTER) p.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE) p.add(image) return p def onBeforeTabSelected(self, sender, tabIndex): # Returning False disables the tab. if tabIndex == 4: return False return True def onTabSelected(self, sender, tabIndex): bar = self.fTabs.getTabBar() if tabIndex == 0: bar.getTabWidget(0).setText('1634 (selected)') else: bar.getTabWidget(0).setText('1634 (not selected)')
class Tabs(Sink): def __init__(self): Sink.__init__(self) self.fTabs = TabPanel() self.fTabs.add( self.createImage(self.baseURL() + "rembrandt/JohannesElison.jpg"), "1634") self.fTabs.add( self.createImage(self.baseURL() + "rembrandt/SelfPortrait1640.jpg"), "1640") self.fTabs.add( self.createImage(self.baseURL() + "rembrandt/LaMarcheNocturne.jpg"), "1642") self.fTabs.add( self.createImage(self.baseURL() + "rembrandt/TheReturnOfTheProdigalSon.jpg"), "1662") self.fTabs.selectTab(0) self.fTabs.setWidth("100%") self.fTabs.setHeight("100%") self.initWidget(self.fTabs) def onShow(self): pass def createImage(self, imageUrl): image = Image(imageUrl) image.setStyleName("ks-images-Image") p = VerticalPanel() p.setHorizontalAlignment(HasAlignment.ALIGN_CENTER) p.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE) p.add(image) return p