def onModuleLoad(self): self.curInfo = '' self.curSink = None self.description = HTML() self.sink_list = SinkList() self.panel = DockPanel() self.loadSinks() self.sinkContainer = DockPanel() self.sinkContainer.setStyleName("ks-Sink") vp = VerticalPanel() vp.setWidth("100%") vp.add(self.description) vp.add(self.sinkContainer) self.description.setStyleName("ks-Info") self.panel.add(self.sink_list, DockPanel.WEST) self.panel.add(vp, DockPanel.CENTER) self.panel.setCellVerticalAlignment(self.sink_list, HasAlignment.ALIGN_TOP) self.panel.setCellWidth(vp, "100%") History().addHistoryListener(self) RootPanel().add(self.panel) initToken = History().getToken() if len(initToken): self.onHistoryChanged(initToken) else: self.showIntro()
def __init__(self, owner): self.owner = owner self.bar = DockPanel() self.gotoFirst = Button("<<", self) self.gotoNext = Button(">", self) self.gotoPrev = Button("<", self) self.status = HTML() self.setWidget(self.bar) self.bar.setStyleName("navbar") self.status.setStyleName("status") buttons = HorizontalPanel() buttons.add(self.gotoFirst) buttons.add(self.gotoPrev) buttons.add(self.gotoNext) self.bar.add(buttons, DockPanel.EAST) self.bar.setCellHorizontalAlignment(buttons, HasAlignment.ALIGN_RIGHT) self.bar.add(self.status, DockPanel.CENTER) self.bar.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE) self.bar.setCellHorizontalAlignment(self.status, HasAlignment.ALIGN_RIGHT) self.bar.setCellVerticalAlignment(self.status, HasAlignment.ALIGN_MIDDLE) self.bar.setCellWidth(self.status, "100%") self.gotoPrev.setEnabled(False) self.gotoFirst.setEnabled(False)
def onModuleLoad(self): self.curInfo='' self.curSink=None self.description=HTML() self.sink_list=SinkList() self.panel=DockPanel() self.loadSinks() self.sinkContainer = DockPanel() self.sinkContainer.setStyleName("ks-Sink") vp=VerticalPanel() vp.setWidth("100%") vp.add(self.description) vp.add(self.sinkContainer) self.description.setStyleName("ks-Info") self.panel.add(self.sink_list, DockPanel.WEST) self.panel.add(vp, DockPanel.CENTER) self.panel.setCellVerticalAlignment(self.sink_list, HasAlignment.ALIGN_TOP) self.panel.setCellWidth(vp, "100%") History().addHistoryListener(self) RootPanel().add(self.panel) #RootPanel().add(Logger()) #Show the initial screen. initToken = History().getToken() if len(initToken): self.onHistoryChanged(initToken) else: self.showInfo()
def __init__(self, provider, columns, columnStyles, rowCount): Composite.__init__(self) self.acceptor = RowDataAcceptorImpl(self) self.outer = DockPanel() self.startRow = 0 self.grid = Grid() self.navbar = NavBar(self) self.provider = provider self.setWidget(self.outer) self.grid.setStyleName("table") self.outer.add(self.navbar, DockPanel.NORTH) self.outer.add(self.grid, DockPanel.CENTER) self.initTable(columns, columnStyles, rowCount) self.setStyleName("DynaTable-DynaTableWidget")
def __init__(self, owner): self.owner = owner self.bar = DockPanel() self.gotoFirst = Button("<<", self) self.gotoNext = Button(">", self) self.gotoPrev = Button("<", self) self.status = HTML() self.initWidget(self.bar) self.bar.setStyleName("navbar") self.status.setStyleName("status") buttons = HorizontalPanel() buttons.add(self.gotoFirst) buttons.add(self.gotoPrev) buttons.add(self.gotoNext) self.bar.add(buttons, DockPanel.EAST) self.bar.setCellHorizontalAlignment(buttons, HasAlignment.ALIGN_RIGHT) self.bar.add(self.status, DockPanel.CENTER) self.bar.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE) self.bar.setCellHorizontalAlignment(self.status, HasAlignment.ALIGN_RIGHT) self.bar.setCellVerticalAlignment(self.status, HasAlignment.ALIGN_MIDDLE) self.bar.setCellWidth(self.status, "100%") self.gotoPrev.setEnabled(False) self.gotoFirst.setEnabled(False)
class DynaTableWidget(Composite): def __init__(self, provider, columns, columnStyles, rowCount): Composite.__init__(self) self.acceptor = RowDataAcceptorImpl(self) self.outer = DockPanel() self.startRow = 0 self.grid = Grid() self.navbar = NavBar(self) self.provider = provider self.setWidget(self.outer) self.grid.setStyleName("table") self.outer.add(self.navbar, DockPanel.NORTH) self.outer.add(self.grid, DockPanel.CENTER) self.initTable(columns, columnStyles, rowCount) self.setStyleName("DynaTable-DynaTableWidget") def initTable(self, columns, columnStyles, rowCount): self.grid.resize(rowCount + 1, len(columns)) for i in range(len(columns)): caption = columns[i] self.grid.setText(0, i, columns[i]) if columnStyles: self.grid.cellFormatter.setStyleName( 0, i, columnStyles[i] + "header") def setStatusText(self, text): self.navbar.status.setText(text) def clearStatusText(self, text): self.navbar.status.setHTML(" ") def refresh(self): self.navbar.gotoFirst.setEnabled(False) self.navbar.gotoPrev.setEnabled(False) self.navbar.gotoNext.setEnabled(False) self.setStatusText("Please wait...") self.provider.updateRowData(self.startRow, self.grid.getRowCount() - 1, self.acceptor) def setRowCount(self, rows): self.grid.resizeRows(rows) def getDataRowCount(self): return self.grid.getRowCount() - 1
class DynaTableWidget(Composite): def __init__(self, provider, columns, columnStyles, rowCount): Composite.__init__(self) self.acceptor = RowDataAcceptorImpl(self) self.outer = DockPanel() self.startRow = 0 self.grid = Grid() self.navbar = NavBar(self) self.provider = provider self.setWidget(self.outer) self.grid.setStyleName("table") self.outer.add(self.navbar, DockPanel.NORTH) self.outer.add(self.grid, DockPanel.CENTER) self.initTable(columns, columnStyles, rowCount) self.setStyleName("DynaTable-DynaTableWidget") def initTable(self, columns, columnStyles, rowCount): self.grid.resize(rowCount + 1, len(columns)) for i in range(len(columns)): caption = columns[i] self.grid.setText(0, i, columns[i]) if columnStyles: self.grid.cellFormatter.setStyleName(0, i, columnStyles[i] + "header") def setStatusText(self, text): self.navbar.status.setText(text) def clearStatusText(self, text): self.navbar.status.setHTML(" ") def refresh(self): self.navbar.gotoFirst.setEnabled(False) self.navbar.gotoPrev.setEnabled(False) self.navbar.gotoNext.setEnabled(False) self.setStatusText("Please wait...") self.provider.updateRowData(self.startRow, self.grid.getRowCount() - 1, self.acceptor) def setRowCount(self, rows): self.grid.resizeRows(rows) def getDataRowCount(self): return self.grid.getRowCount() - 1
def onModuleLoad(self): self.panel=DockPanel() self.panel.add(Label("east"), DockPanel.EAST) self.panel.add(Label("west"), DockPanel.WEST) self.panel.add(Label("center"), DockPanel.CENTER) self.panel.add(Label("north"), DockPanel.NORTH) self.panel.add(Label("south"), DockPanel.SOUTH) self.panel.add(Label("south2"), DockPanel.SOUTH) RootPanel().add(self.panel)
def __init__(self, provider, columns, columnStyles, rowCount): Composite.__init__(self) self.acceptor = RowDataAcceptorImpl(self) self.outer = DockPanel() self.startRow = 0 self.grid = Grid() self.navbar = NavBar(self) self.provider = provider self.initWidget(self.outer) self.grid.setStyleName("table") self.outer.add(self.navbar, DockPanel.NORTH) self.outer.add(self.grid, DockPanel.CENTER) self.initTable(columns, columnStyles, rowCount) self.setStyleName("DynaTable-DynaTableWidget")
def __init__(self): Composite.__init__(self) panel = VerticalPanel() headerPanel = VerticalPanel() self.subject = HTML() self.sender = HTML() self.recipient = HTML() self.body = HTML() self.scroller = ScrollPanel(self.body) self.body.setWordWrap(True) headerPanel.add(self.subject) headerPanel.add(self.sender) headerPanel.add(self.recipient) headerPanel.setWidth("100%") innerPanel = DockPanel() innerPanel.add(headerPanel, DockPanel.NORTH) innerPanel.add(self.scroller, DockPanel.CENTER) innerPanel.setCellHeight(self.scroller, "100%") panel.add(innerPanel) innerPanel.setSize("100%", "100%") self.scroller.setSize("100%", "100%") self.initWidget(panel) self.setStyleName("mail-Detail") headerPanel.setStyleName("mail-DetailHeader") innerPanel.setStyleName("mail-DetailInner") self.subject.setStyleName("mail-DetailSubject") self.sender.setStyleName("mail-DetailSender") self.recipient.setStyleName("mail-DetailRecipient") self.body.setStyleName("mail-DetailBody")
def __init__(self): DialogBox.__init__(self) self.setText("Sample DialogBox with embedded Frame") iframe = Frame(Popups.baseURL() + "rembrandt/LaMarcheNocturne.html") closeButton = Button("Close", self) msg = HTML("<center>This is an example of a standard dialog box component.<br> You can put pretty much anything you like into it,<br>such as the following IFRAME:</center>", True) dock = DockPanel() dock.setSpacing(4) dock.add(closeButton, DockPanel.SOUTH) dock.add(msg, DockPanel.NORTH) dock.add(iframe, DockPanel.CENTER) dock.setCellHorizontalAlignment(closeButton, HasAlignment.ALIGN_RIGHT) dock.setCellWidth(iframe, "100%") dock.setWidth("100%") iframe.setWidth("36em") iframe.setHeight("20em") self.setWidget(dock)
def __init__(self): DialogBox.__init__(self) # Use this opportunity to set the dialog's caption. self.setText("About the Mail Sample") # Create a DockPanel to contain the 'about' label and the 'OK' button. outer = DockPanel() outer.setSpacing(4) outer.add(Image(AboutDialog.LOGO_IMAGE), DockPanel.WEST) # Create the 'OK' button, along with a listener that hides the dialog # when the button is clicked. Adding it to the 'south' position within # the dock causes it to be placed at the bottom. buttonPanel = HorizontalPanel() buttonPanel.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT) buttonPanel.add(Button("Close", self)) outer.add(buttonPanel, DockPanel.SOUTH) # Create the 'about' label. Placing it in the 'rest' position within the # dock causes it to take up any remaining space after the 'OK' button # has been laid out. textplain = "This sample application demonstrates the construction " textplain += "of a complex user interface using pyjamas' built-in widgets. Have a look " textplain += "at the code to see how easy it is to build your own apps!" text = HTML(textplain) text.setStyleName("mail-AboutText") outer.add(text, DockPanel.CENTER) # Add a bit of spacing and margin to the dock to keep the components from # being placed too closely together. outer.setSpacing(8) self.setWidget(outer)
class AddonsGallery: def onHistoryChanged(self, token): info = self.sink_list.find(token) if info: self.show(info, False) else: self.showIntro() def onModuleLoad(self): self.curInfo = '' self.curSink = None self.description = HTML() self.sink_list = SinkList() self.panel = DockPanel() self.loadSinks() self.sinkContainer = DockPanel() self.sinkContainer.setStyleName("ks-Sink") vp = VerticalPanel() vp.setWidth("100%") vp.add(self.description) vp.add(self.sinkContainer) self.description.setStyleName("ks-Info") self.panel.add(self.sink_list, DockPanel.WEST) self.panel.add(vp, DockPanel.CENTER) self.panel.setCellVerticalAlignment(self.sink_list, HasAlignment.ALIGN_TOP) self.panel.setCellWidth(vp, "100%") History().addHistoryListener(self) RootPanel().add(self.panel) initToken = History().getToken() if len(initToken): self.onHistoryChanged(initToken) else: self.showIntro() def show(self, info, affectHistory): if info == self.curInfo: return self.curInfo = info if self.curSink <> None: self.curSink.onHide() self.sinkContainer.remove(self.curSink) self.curSink = info.getInstance() self.sink_list.setSinkSelection(info.getName()) self.description.setHTML(info.getDescription()) if (affectHistory): History().newItem(info.getName()) self.sinkContainer.add(self.curSink, DockPanel.CENTER) self.sinkContainer.setCellWidth(self.curSink, "100%") self.sinkContainer.setCellHeight(self.curSink, "100%") self.sinkContainer.setCellVerticalAlignment(self.curSink, DockPanel.ALIGN_TOP) self.curSink.onShow() def loadSinks(self): self.sink_list.addSink(IntroTab.init()) self.sink_list.addSink(TooltipTab.init()) self.sink_list.addSink(AutoCompleteTab.init()) self.sink_list.addSink(CanvasTab.init()) def showIntro(self): self.show(self.sink_list.find("Intro"))
class KitchenSink: def onHistoryChanged(self, token): info = self.sink_list.find(token) if info: self.show(info, False) else: self.showInfo() def onModuleLoad(self): self.curInfo = '' self.curSink = None self.description = HTML() self.sink_list = SinkList() self.panel = DockPanel() self.loadSinks() self.sinkContainer = DockPanel() self.sinkContainer.setStyleName("ks-Sink") vp = VerticalPanel() vp.setWidth("100%") vp.add(self.description) vp.add(self.sinkContainer) self.description.setStyleName("ks-Info") self.panel.add(self.sink_list, DockPanel.WEST) self.panel.add(vp, DockPanel.CENTER) self.panel.setCellVerticalAlignment(self.sink_list, HasAlignment.ALIGN_TOP) self.panel.setCellWidth(vp, "100%") History().addHistoryListener(self) RootPanel().add(self.panel) RootPanel().add(Logger()) #Show the initial screen. initToken = History().getToken() if len(initToken): self.onHistoryChanged(initToken) else: self.showInfo() def show(self, info, affectHistory): if info == self.curInfo: return self.curInfo = info Logger("", "showing " + info.getName()) if self.curSink <> None: self.curSink.onHide() Logger("", "removing " + self.curSink) self.sinkContainer.remove(self.curSink) self.curSink = info.getInstance() self.sink_list.setSinkSelection(info.getName()) self.description.setHTML(info.getDescription()) if (affectHistory): History().newItem(info.getName()) self.sinkContainer.add(self.curSink, DockPanel.CENTER) self.sinkContainer.setCellWidth(self.curSink, "100%") self.sinkContainer.setCellHeight(self.curSink, "100%") self.sinkContainer.setCellVerticalAlignment(self.curSink, DockPanel.ALIGN_TOP) self.curSink.onShow() def loadSinks(self): self.sink_list.addSink(Info.init()) self.sink_list.addSink(Buttons.init()) self.sink_list.addSink(Menus.init()) self.sink_list.addSink(Images.init()) self.sink_list.addSink(Layouts.init()) self.sink_list.addSink(Lists.init()) self.sink_list.addSink(Popups.init()) self.sink_list.addSink(Tables.init()) self.sink_list.addSink(Text.init()) self.sink_list.addSink(Trees.init()) self.sink_list.addSink(Frames.init()) self.sink_list.addSink(Tabs.init()) def showInfo(self): self.show(self.sink_list.find("Info"), False)
def __init__(self): text = "This is a <code>ScrollPanel</code> contained at " text += "the center of a <code>DockPanel</code>. " text += "By putting some fairly large contents " text += "in the middle and setting its size explicitly, it becomes a " text += "scrollable area within the page, but without requiring the use of " text += "an IFRAME." text += "Here's quite a bit more meaningless text that will serve primarily " text += "to make this thing scroll off the bottom of its visible area. " text += "Otherwise, you might have to make it really, really small in order " text += "to see the nifty scroll bars!" contents = HTML(text) scroller = ScrollPanel(contents) scroller.setStyleName("ks-layouts-Scroller") dock = DockPanel() dock.setHorizontalAlignment(HasAlignment.ALIGN_CENTER) north0 = HTML("This is the <i>first</i> north component", True) east = HTML("<center>This<br>is<br>the<br>east<br>component</center>", True) south = HTML("This is the south component") west = HTML("<center>This<br>is<br>the<br>west<br>component</center>", True) north1 = HTML("This is the <b>second</b> north component", True) dock.add(north0, DockPanel.NORTH) dock.add(east, DockPanel.EAST) dock.add(south, DockPanel.SOUTH) dock.add(west, DockPanel.WEST) dock.add(north1, DockPanel.NORTH) dock.add(scroller, DockPanel.CENTER) Logger("Layouts", "TODO: flowpanel") flow = FlowPanel() for i in range(8): flow.add(CheckBox("Flow " + i)) horz = HorizontalPanel() horz.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE) horz.add(Button("Button")) horz.add(HTML("<center>This is a<br>very<br>tall thing</center>", True)) horz.add(Button("Button")) vert = VerticalPanel() vert.setHorizontalAlignment(HasAlignment.ALIGN_CENTER) vert.add(Button("Small")) vert.add(Button("--- BigBigBigBig ---")) vert.add(Button("tiny")) menu = MenuBar() menu0 = MenuBar(True) menu1 = MenuBar(True) menu.addNewItem("menu0", False, None, menu0) menu.addNewItem("menu1", False, None, menu1) menu0.addNewItem("child00") menu0.addNewItem("child01") menu0.addNewItem("child02") menu1.addNewItem("child10") menu1.addNewItem("child11") menu1.addNewItem("child12") Logger("Layouts", "TODO: htmlpanel") id = HTMLPanel.createUniqueId() text = "This is an <code>HTMLPanel</code>. It allows you to add " text += "components inside existing HTML, like this:" + "<span id='" + id text += "'></span>" + "Notice how the menu just fits snugly in there? Cute." html = HTMLPanel(text) DOM.setStyleAttribute(menu.getElement(), "display", "inline") html.add(menu, id) panel = VerticalPanel() panel.setSpacing(8) panel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER) panel.add(self.makeLabel("Dock Panel")) panel.add(dock) panel.add(self.makeLabel("Flow Panel")) panel.add(flow) panel.add(self.makeLabel("Horizontal Panel")) panel.add(horz) panel.add(self.makeLabel("Vertical Panel")) panel.add(vert) panel.add(self.makeLabel("HTML Panel")) panel.add(html) self.setWidget(panel) self.setStyleName("ks-layouts")
class NavBar(Composite): def __init__(self, owner): self.owner = owner self.bar = DockPanel() self.gotoFirst = Button("<<", self) self.gotoNext = Button(">", self) self.gotoPrev = Button("<", self) self.status = HTML() self.initWidget(self.bar) self.bar.setStyleName("navbar") self.status.setStyleName("status") buttons = HorizontalPanel() buttons.add(self.gotoFirst) buttons.add(self.gotoPrev) buttons.add(self.gotoNext) self.bar.add(buttons, DockPanel.EAST) self.bar.setCellHorizontalAlignment(buttons, HasAlignment.ALIGN_RIGHT) self.bar.add(self.status, DockPanel.CENTER) self.bar.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE) self.bar.setCellHorizontalAlignment(self.status, HasAlignment.ALIGN_RIGHT) self.bar.setCellVerticalAlignment(self.status, HasAlignment.ALIGN_MIDDLE) self.bar.setCellWidth(self.status, "100%") self.gotoPrev.setEnabled(False) self.gotoFirst.setEnabled(False) def onClick(self, sender): if sender == self.gotoNext: self.owner.startRow += self.owner.getDataRowCount() self.owner.refresh() elif sender == self.gotoPrev: self.owner.startRow -= self.owner.getDataRowCount() if self.owner.startRow < 0: self.owner.startRow = 0 self.owner.refresh() elif sender == self.gotoFirst: self.owner.startRow = 0 self.owner.refresh()
class AddonsGallery: def onHistoryChanged(self, token): info = self.sink_list.find(token) if info: self.show(info, False) else: self.showIntro() def onModuleLoad(self): self.curInfo='' self.curSink=None self.description=HTML() self.sink_list=SinkList() self.panel=DockPanel() self.loadSinks() self.sinkContainer = DockPanel() self.sinkContainer.setStyleName("ks-Sink") vp=VerticalPanel() vp.setWidth("100%") vp.add(self.description) vp.add(self.sinkContainer) self.description.setStyleName("ks-Info") self.panel.add(self.sink_list, DockPanel.WEST) self.panel.add(vp, DockPanel.CENTER) self.panel.setCellVerticalAlignment(self.sink_list, HasAlignment.ALIGN_TOP) self.panel.setCellWidth(vp, "100%") History().addHistoryListener(self) RootPanel().add(self.panel) initToken = History().getToken() if len(initToken): self.onHistoryChanged(initToken) else: self.showIntro() def show(self, info, affectHistory): if info == self.curInfo: return self.curInfo = info if self.curSink <> None: self.curSink.onHide() self.sinkContainer.remove(self.curSink) self.curSink = info.getInstance() self.sink_list.setSinkSelection(info.getName()) self.description.setHTML(info.getDescription()) if (affectHistory): History().newItem(info.getName()) self.sinkContainer.add(self.curSink, DockPanel.CENTER) self.sinkContainer.setCellWidth(self.curSink, "100%") self.sinkContainer.setCellHeight(self.curSink, "100%") self.sinkContainer.setCellVerticalAlignment(self.curSink, HasAlignment.ALIGN_TOP) self.curSink.onShow() def loadSinks(self): self.sink_list.addSink(IntroTab.init()) self.sink_list.addSink(TooltipTab.init()) self.sink_list.addSink(AutoCompleteTab.init()) self.sink_list.addSink(CanvasTab.init()) def showIntro(self): self.show(self.sink_list.find("Intro"))
def __init__(self): DialogBox.__init__(self) self.setText("Sample DialogBox with embedded Frame") iframe = Frame(Popups.baseURL() + "rembrandt/LaMarcheNocturne.html") closeButton = Button("Close", self) msg = HTML("<center>This is an example of a standard dialog box component.<br> You can put pretty much anything you like into it,<br>such as the following IFRAME:</center>", True) dock = DockPanel() dock.setSpacing(4) dock.add(closeButton, DockPanel.SOUTH) dock.add(msg, DockPanel.NORTH) dock.add(iframe, DockPanel.CENTER) dock.setCellHorizontalAlignment(closeButton, HasAlignment.ALIGN_RIGHT) dock.setCellWidth(iframe, "100%") dock.setWidth("100%") iframe.setWidth("36em") iframe.setHeight("20em") self.add(dock)
class KitchenSink: def onHistoryChanged(self, token): print "history changed", token info = self.sink_list.find(token) if info: self.show(info, False) else: self.showInfo() def onModuleLoad(self): self.curInfo='' self.curSink=None self.description=HTML() self.sink_list=SinkList() self.panel=DockPanel() self.loadSinks() self.sinkContainer = DockPanel() self.sinkContainer.setStyleName("ks-Sink") vp=VerticalPanel() vp.setWidth("100%") vp.add(self.description) vp.add(self.sinkContainer) self.description.setStyleName("ks-Info") self.panel.add(self.sink_list, DockPanel.WEST) self.panel.add(vp, DockPanel.CENTER) self.panel.setCellVerticalAlignment(self.sink_list, HasAlignment.ALIGN_TOP) self.panel.setCellWidth(vp, "100%") History().addHistoryListener(self) RootPanel().add(self.panel) #RootPanel().add(Logger()) #Show the initial screen. initToken = History().getToken() if len(initToken): self.onHistoryChanged(initToken) else: self.showInfo() def show(self, info, affectHistory): if info == self.curInfo: return self.curInfo = info #Logger().write("", "showing " + info.getName()) if self.curSink <> None: self.curSink.onHide() #Logger().write("", "removing " + self.curSink) self.sinkContainer.remove(self.curSink) self.curSink = info.getInstance() self.sink_list.setSinkSelection(info.getName()) self.description.setHTML(info.getDescription()) if (affectHistory): History().newItem(info.getName()) self.sinkContainer.add(self.curSink, DockPanel.CENTER) self.sinkContainer.setCellWidth(self.curSink, "100%") self.sinkContainer.setCellHeight(self.curSink, "100%") self.sinkContainer.setCellVerticalAlignment(self.curSink, HasAlignment.ALIGN_TOP) self.curSink.onShow() def loadSinks(self): self.sink_list.addSink(Info.init()) self.sink_list.addSink(Buttons.init()) self.sink_list.addSink(Menus.init()) self.sink_list.addSink(Images.init()) self.sink_list.addSink(Layouts.init()) self.sink_list.addSink(Lists.init()) self.sink_list.addSink(Popups.init()) self.sink_list.addSink(Tables.init()) self.sink_list.addSink(Text.init()) self.sink_list.addSink(Trees.init()) self.sink_list.addSink(Frames.init()) self.sink_list.addSink(Tabs.init()) def showInfo(self): self.show(self.sink_list.find("Info"), False)
def __init__(self): text="This is a <code>ScrollPanel</code> contained at " text+= "the center of a <code>DockPanel</code>. " text+= "By putting some fairly large contents " text+= "in the middle and setting its size explicitly, it becomes a " text+= "scrollable area within the page, but without requiring the use of " text+= "an IFRAME." text+= "Here's quite a bit more meaningless text that will serve primarily " text+= "to make this thing scroll off the bottom of its visible area. " text+= "Otherwise, you might have to make it really, really small in order " text+= "to see the nifty scroll bars!" contents = HTML(text) scroller = ScrollPanel(contents) scroller.setStyleName("ks-layouts-Scroller") dock = DockPanel() dock.setHorizontalAlignment(HasAlignment.ALIGN_CENTER) north0 = HTML("This is the <i>first</i> north component", True) east = HTML("<center>This<br>is<br>the<br>east<br>component</center>", True) south = HTML("This is the south component") west = HTML("<center>This<br>is<br>the<br>west<br>component</center>", True) north1 = HTML("This is the <b>second</b> north component", True) dock.add(north0, DockPanel.NORTH) dock.add(east, DockPanel.EAST) dock.add(south, DockPanel.SOUTH) dock.add(west, DockPanel.WEST) dock.add(north1, DockPanel.NORTH) dock.add(scroller, DockPanel.CENTER) Logger.write("Layouts", "TODO: flowpanel") flow = FlowPanel() for i in range(8): flow.add(CheckBox("Flow " + i)) horz = HorizontalPanel() horz.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE) horz.add(Button("Button")) horz.add(HTML("<center>This is a<br>very<br>tall thing</center>", True)) horz.add(Button("Button")) vert = VerticalPanel() vert.setHorizontalAlignment(HasAlignment.ALIGN_CENTER) vert.add(Button("Small")) vert.add(Button("--- BigBigBigBig ---")) vert.add(Button("tiny")) menu = MenuBar() menu0 = MenuBar(True) menu1 = MenuBar(True) menu.addItem("menu0", menu0) menu.addItem("menu1", menu1) menu0.addItem("child00") menu0.addItem("child01") menu0.addItem("child02") menu1.addItem("child10") menu1.addItem("child11") menu1.addItem("child12") Logger.write("Layouts", "TODO: htmlpanel") id = HTMLPanel.createUniqueId() text="This is an <code>HTMLPanel</code>. It allows you to add " text+="components inside existing HTML, like this:" + "<span id='" + id text+="'></span>" + "Notice how the menu just fits snugly in there? Cute." html = HTMLPanel(text) DOM.setStyleAttribute(menu.getElement(), "display", "inline") html.add(menu, id) panel = VerticalPanel() panel.setSpacing(8) panel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER) panel.add(self.makeLabel("Dock Panel")) panel.add(dock) panel.add(self.makeLabel("Flow Panel")) panel.add(flow) panel.add(self.makeLabel("Horizontal Panel")) panel.add(horz) panel.add(self.makeLabel("Vertical Panel")) panel.add(vert) panel.add(self.makeLabel("HTML Panel")) panel.add(html) self.initWidget(panel) self.setStyleName("ks-layouts")
class NavBar(Composite): def __init__(self, owner): self.owner = owner self.bar = DockPanel() self.gotoFirst = Button("<<", self) self.gotoNext = Button(">", self) self.gotoPrev = Button("<", self) self.status = HTML() self.setWidget(self.bar) self.bar.setStyleName("navbar") self.status.setStyleName("status") buttons = HorizontalPanel() buttons.add(self.gotoFirst) buttons.add(self.gotoPrev) buttons.add(self.gotoNext) self.bar.add(buttons, DockPanel.EAST) self.bar.setCellHorizontalAlignment(buttons, HasAlignment.ALIGN_RIGHT) self.bar.add(self.status, DockPanel.CENTER) self.bar.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE) self.bar.setCellHorizontalAlignment(self.status, HasAlignment.ALIGN_RIGHT) self.bar.setCellVerticalAlignment(self.status, HasAlignment.ALIGN_MIDDLE) self.bar.setCellWidth(self.status, "100%") self.gotoPrev.setEnabled(False) self.gotoFirst.setEnabled(False) def onClick(self, sender): if sender == self.gotoNext: self.owner.startRow += self.owner.getDataRowCount() self.owner.refresh() elif sender == self.gotoPrev: self.owner.startRow -= self.owner.getDataRowCount() if self.owner.startRow < 0: self.owner.startRow = 0 self.owner.refresh() elif sender == self.gotoFirst: self.owner.startRow = 0 self.owner.refresh()
def onModuleLoad(self): self.singleton = self topPanel = TopPanel() rightPanel = VerticalPanel() self.mailDetail = MailDetail() self.shortcuts = Shortcuts() topPanel.setWidth("100%") # MailList uses Mail.get() in its constructor, so initialize it after # 'singleton'. mailList = MailList(self.singleton) mailList.setWidth("100%") # Create the right panel, containing the email list & details. rightPanel.add(mailList) rightPanel.add(self.mailDetail) mailList.setWidth("100%") self.mailDetail.setWidth("100%") # Create a dock panel that will contain the menu bar at the top, # the shortcuts to the left, and the mail list & details taking the rest. outer = DockPanel() outer.add(topPanel, DockPanel.NORTH) outer.add(self.shortcuts, DockPanel.WEST) outer.add(rightPanel, DockPanel.CENTER) outer.setWidth("100%") outer.setSpacing(4) outer.setCellWidth(rightPanel, "100%") # Hook the window resize event, so that we can adjust the UI. #FIXME need implementation # Window.addWindowResizeListener(this) #Window.addWindowResizeListener(self) # Get rid of scrollbars, and clear out the window's built-in margin, # because we want to take advantage of the entire client area. Window.enableScrolling(False) Window.setMargin("0px") # Finally, add the outer panel to the RootPanel, so that it will be # displayed. #RootPanel.get().add(outer) # FIXME get# RootPanel().add(outer) RootPanel().add(Logger()) # Call the window resized handler to get the initial sizes setup. Doing # this in a deferred command causes it to occur after all widgets' sizes # have been computed by the browser. # FIXME - need implementation# # DeferredCommand.add(onWindowResized(Window.getClientWidth(), Window.getClientHeight())) self.onWindowResized(Window.getClientWidth(), Window.getClientHeight())
def __init__(self): panel = VerticalPanel() headerPanel = VerticalPanel() self.subject = HTML() self.sender = HTML() self.recipient = HTML() self.body = HTML() self.scroller = ScrollPanel(self.body) self.body.setWordWrap(True) headerPanel.add(self.subject) headerPanel.add(self.sender) headerPanel.add(self.recipient) headerPanel.setWidth("100%") innerPanel = DockPanel() innerPanel.add(headerPanel, DockPanel.NORTH) innerPanel.add(self.scroller, DockPanel.CENTER) innerPanel.setCellHeight(self.scroller, "100%") panel.add(innerPanel) innerPanel.setSize("100%", "100%") self.scroller.setSize("100%", "100%") self.setWidget(panel) self.setStyleName("mail-Detail") headerPanel.setStyleName("mail-DetailHeader") innerPanel.setStyleName("mail-DetailInner") self.subject.setStyleName("mail-DetailSubject") self.sender.setStyleName("mail-DetailSender") self.recipient.setStyleName("mail-DetailRecipient") self.body.setStyleName("mail-DetailBody") Logger("Mail detail", " ")
def __init__(self): DialogBox.__init__(self) # Use this opportunity to set the dialog's caption. self.setText("About the Mail Sample") # Create a DockPanel to contain the 'about' label and the 'OK' button. outer = DockPanel() outer.setSpacing(4) outer.add(Image(AboutDialog.LOGO_IMAGE), DockPanel.WEST) # Create the 'OK' button, along with a listener that hides the dialog # when the button is clicked. Adding it to the 'south' position within # the dock causes it to be placed at the bottom. buttonPanel = HorizontalPanel() buttonPanel.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT) buttonPanel.add(Button("Close", self)) outer.add(buttonPanel, DockPanel.SOUTH) # Create the 'about' label. Placing it in the 'rest' position within the # dock causes it to take up any remaining space after the 'OK' button # has been laid out. textplain = "This sample application demonstrates the construction " textplain += "of a complex user interface using pyjamas' built-in widgets. Have a look " textplain += "at the code to see how easy it is to build your own apps!" text = HTML(textplain) text.setStyleName("mail-AboutText") outer.add(text, DockPanel.CENTER) # Add a bit of spacing and margin to the dock to keep the components from # being placed too closely together. outer.setSpacing(8) self.add(outer)
def __init__(self): self.curImage=0 self.image=Image() self.loadingImage = Image(self.baseURL() + "images/blanksearching.gif") self.nextButton = Image(self.baseURL() + "rembrandt/forward.gif") self.prevButton = Image(self.baseURL() + "rembrandt/back.gif") self.sImages=["rembrandt/JohannesElison.jpg", "rembrandt/LaMarcheNocturne.jpg", "rembrandt/SelfPortrait1628.jpg", "rembrandt/SelfPortrait1640.jpg", "rembrandt/TheArtistInHisStudio.jpg", "rembrandt/TheReturnOfTheProdigalSon.jpg"] for i in range(len(self.sImages)): self.sImages[i]=self.baseURL() + self.sImages[i] self.image.addLoadListener(self) self.prevButton.addClickListener(self) self.nextButton.addClickListener(self) topPanel = DockPanel() topPanel.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE) topPanel.add(self.prevButton, DockPanel.WEST) topPanel.add(self.nextButton, DockPanel.EAST) topPanel.add(self.loadingImage, DockPanel.CENTER) panel = VerticalPanel() panel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER) panel.add(HTML("<h2>A Bit of Rembrandt</h2>", True)) panel.add(topPanel) panel.add(self.image) panel.setWidth("100%") self.setWidget(panel) self.image.setStyleName("ks-images-Image") self.nextButton.setStyleName("ks-images-Button") self.prevButton.setStyleName("ks-images-Button") self.loadImage(0)