def __init__(self): colour_grid = ColourGridCanvas() rotated = RotatedCanvas() spheres = SpheresCanvas() pattern = PatternCanvas() spiro = SpiroCanvas() self.solar = SolarCanvas() row0 = HorizontalPanel() row0.setSpacing(8) row0.add(colour_grid) row0.add(rotated) row0.add(spheres) row0.add(pattern) row1 = HorizontalPanel() row1.setSpacing(8) row1.add(self.solar) row1.add(spiro) panel = VerticalPanel() panel.add(row0) panel.add(row1) self.setWidget(panel)
def __init__(self): self.signOutLink = HTML("<a href='javascript:;'>Sign Out</a>") self.aboutLink = HTML("<a href='javascript:;'>About</a>") outer = HorizontalPanel() inner = VerticalPanel() outer.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT) inner.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT) links = HorizontalPanel() links.setSpacing(4) links.add(self.signOutLink) links.add(self.aboutLink) outer.add(inner) inner.add(HTML("<b>Welcome back, [email protected]</b>")) inner.add(links) self.signOutLink.addClickListener(self) self.aboutLink.addClickListener(self) self.setWidget(outer) inner.setStyleName("mail-TopPanel") links.setStyleName("mail-TopPanelLinks")
def onModuleLoad(self): self.TEXT_WAITING = "Waiting for response..." self.TEXT_ERROR = "Server Error" self.remote_php = EchoServicePHP() self.remote_py = EchoServicePython() self.status=Label() self.text_area = TextArea() self.text_area.setText(r"{'Test'} [\"String\"]") self.text_area.setCharacterWidth(80) self.text_area.setVisibleLines(8) self.button_php = Button("Send to PHP Service", self) self.button_py = Button("Send to Python Service", self) buttons = HorizontalPanel() buttons.add(self.button_php) buttons.add(self.button_py) buttons.setSpacing(8) info = r"<h2>JSON-RPC Example</h2><p>This example demonstrates the calling of server services with <a href=\"http://json-rpc.org/\">JSON-RPC</a>." info += "<p>Enter some text below, and press a button to send the text to an Echo service on your server. An echo service simply sends the exact same text back that it receives." panel = VerticalPanel() panel.add(HTML(info)) panel.add(self.text_area) panel.add(buttons) panel.add(self.status) RootPanel().add(panel)
def __init__(self): Composite.__init__(self) self.signOutLink = HTML("<a href='javascript:;'>Sign Out</a>") self.aboutLink = HTML("<a href='javascript:;'>About</a>") outer = HorizontalPanel() inner = VerticalPanel() outer.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT) inner.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT) links = HorizontalPanel() links.setSpacing(4) links.add(self.signOutLink) links.add(self.aboutLink) outer.add(inner) inner.add(HTML("<b>Welcome back, [email protected]</b>")) inner.add(links) self.signOutLink.addClickListener(self) self.aboutLink.addClickListener(self) self.initWidget(outer) inner.setStyleName("mail-TopPanel") links.setStyleName("mail-TopPanelLinks")
def __init__(self): colours = ['Azure', 'Red', 'Rust', 'Green', 'Beige', 'Brass', 'Brown', 'Bronze', 'Blue', 'Black', 'Burgundy', 'Pink', 'Gold', 'Gray', 'Purple', 'Yellow', 'White'] self.colour_input = AutoCompleteTextBox() self.colour_input.setCompletionItems(colours) panel = HorizontalPanel() panel.add(HTML("Enter a colour: ")) panel.add(self.colour_input) panel.setSpacing(8) self.setWidget(panel)
def onModuleLoad(self): self.TEXT_WAITING = "Waiting for response..." self.TEXT_ERROR = "Server Error" self.METHOD_ECHO = "Echo" self.METHOD_REVERSE = "Reverse" self.METHOD_UPPERCASE = "UPPERCASE" self.METHOD_LOWERCASE = "lowercase" self.methods = [self.METHOD_ECHO, self.METHOD_REVERSE, self.METHOD_UPPERCASE, self.METHOD_LOWERCASE] self.remote_php = EchoServicePHP() self.remote_py = EchoServicePython() self.status=Label() self.text_area = TextArea() self.text_area.setText(r"{'Test'} [\"String\"]") #self.text_area.setCharacterWidth(80) self.text_area.setVisibleLines(8) self.method_list = ListBox() #self.method_list.setMultipleSelect(True) self.method_list.setVisibleItemCount(1) for method in self.methods: self.method_list.addItem(method) self.method_list.setSelectedIndex(0) method_panel = HorizontalPanel() method_panel.add(HTML("Remote string method to call: ")) method_panel.add(self.method_list) method_panel.setSpacing(8) self.button_php = Button("Send to PHP Service", self) self.button_py = Button("Send to Python Service", self) buttons = HorizontalPanel() buttons.add(self.button_php) buttons.add(self.button_py) buttons.setSpacing(8) info = r"<h2>JSON-RPC Example</h2><p>This example demonstrates the calling of server services with <a href=\"http://json-rpc.org/\">JSON-RPC</a>." info += "<p>Enter some text below, and press a button to send the text to an Echo service on your server. An echo service simply sends the exact same text back that it receives.</p>" panel = VerticalPanel() panel.add(HTML(info)) panel.add(self.text_area) panel.add(method_panel) panel.add(buttons) panel.add(self.status) RootPanel().add(panel)
def __init__(self): colours = [ 'Azure', 'Red', 'Rust', 'Green', 'Beige', 'Brass', 'Brown', 'Bronze', 'Blue', 'Black', 'Burgundy', 'Pink', 'Gold', 'Gray', 'Purple', 'Yellow', 'White' ] self.colour_input = AutoCompleteTextBox() self.colour_input.setCompletionItems(colours) panel = HorizontalPanel() panel.add(HTML("Enter a colour: ")) panel.add(self.colour_input) panel.setSpacing(8) self.setWidget(panel)
def createTextThing(self, textBox): p = HorizontalPanel() p.setSpacing(4) p.add(textBox) echo = HTML() select_all = Button("select all") p.add(select_all) p.add(echo) listener=TextBoxListener(self, textBox, echo, select_all) select_all.addClickListener(listener) textBox.addKeyboardListener(listener) textBox.addClickListener(listener) return p
def __init__(self): img = Image("images/num1.png") img.addMouseListener(TooltipListener("An image: " + img.getUrl())) img2 = Image("images/num2.png") img2.addMouseListener(TooltipListener("An image: " + img2.getUrl())) html = HTML("Some <i>HTML</i> text.") html.addMouseListener(TooltipListener("An HTML component.")) panel_h = HorizontalPanel() panel_h.add(img) panel_h.add(img2) panel_h.setSpacing(8) panel = VerticalPanel() panel.add(panel_h) panel.add(html) panel.setSpacing(8) self.setWidget(panel)
def __init__(self, contact): # The popup's constructor's argument is a boolean specifying that it # auto-close itself when the user clicks outside of it. PopupPanel.__init__(self, True) inner = VerticalPanel() nameLabel = Label(contact.name) emailLabel = Label(contact.email) inner.add(nameLabel) inner.add(emailLabel) panel = HorizontalPanel() panel.setSpacing(4) panel.add(Image(contact.photo)) panel.add(inner) self.add(panel) self.setStyleName("mail-ContactPopup") nameLabel.setStyleName("mail-ContactPopupName") emailLabel.setStyleName("mail-ContactPopupEmail")
def __init__(self, mailObject): Composite.__init__(self) self.countLabel = HTML() self.newerButton = HTML("<a href='javascript:;'>< newer</a>", True) self.olderButton = HTML("<a href='javascript:;'>older ></a>", True) self.startIndex = 0 self.selectedRow = -1 self.table = FlexTable() self.navBar = HorizontalPanel() self.mailObject = mailObject # Setup the table. self.table.setCellSpacing(0) self.table.setCellPadding(2) self.table.setWidth("100%") # Hook up events. self.table.addTableListener(self) self.newerButton.addClickListener(self) self.olderButton.addClickListener(self) # Create the 'navigation' bar at the upper-right. innerNavBar = HorizontalPanel() innerNavBar.setStyleName("mail-ListNavBar") innerNavBar.setSpacing(8) innerNavBar.add(self.newerButton) innerNavBar.add(self.countLabel) innerNavBar.add(self.olderButton) self.navBar.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT) self.navBar.add(innerNavBar) self.navBar.setWidth("100%") self.initWidget(self.table) self.setStyleName("mail-List") self.initTable() self.update()
def __init__(self, mailObject): self.countLabel = HTML() self.newerButton = HTML("<a href='javascript:;'>< newer</a>", True) self.olderButton = HTML("<a href='javascript:;'>older ></a>", True) self.startIndex = 0 self.selectedRow = -1 self.table = FlexTable() self.navBar = HorizontalPanel() self.mailObject = mailObject # Setup the table. self.table.setCellSpacing(0) self.table.setCellPadding(2) self.table.setWidth("100%") # Hook up events. self.table.addTableListener(self) self.newerButton.addClickListener(self) self.olderButton.addClickListener(self) # Create the 'navigation' bar at the upper-right. innerNavBar = HorizontalPanel() innerNavBar.setStyleName("mail-ListNavBar") innerNavBar.setSpacing(8) innerNavBar.add(self.newerButton) innerNavBar.add(self.countLabel) innerNavBar.add(self.olderButton) self.navBar.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT) self.navBar.add(innerNavBar) self.navBar.setWidth("100%") self.setWidget(self.table) self.setStyleName("mail-List") self.initTable() self.update()
def __init__(self): Sink.__init__(self) self.sStrings = [["foo0", "bar0", "baz0", "toto0", "tintin0"], ["foo1", "bar1", "baz1", "toto1", "tintin1"], ["foo2", "bar2", "baz2", "toto2", "tintin2"], ["foo3", "bar3", "baz3", "toto3", "tintin3"], ["foo4", "bar4", "baz4", "toto4", "tintin4"]] self.combo = ListBox() self.list = ListBox() self.echo = Label() self.combo.setVisibleItemCount(1) self.combo.addChangeListener(self) self.list.setVisibleItemCount(10) self.list.setMultipleSelect(True) for i in range(len(self.sStrings)): self.combo.addItem("List %d" % i) self.combo.setSelectedIndex(0) self.fillList(0) self.list.addChangeListener(self) horz = HorizontalPanel() horz.setVerticalAlignment(HasAlignment.ALIGN_TOP) horz.setSpacing(8) horz.add(self.combo) horz.add(self.list) panel = VerticalPanel() panel.setHorizontalAlignment(HasAlignment.ALIGN_LEFT) panel.add(horz) panel.add(self.echo) self.initWidget(panel) self.echoSelection()
def __init__(self): self.sStrings=[["foo0", "bar0", "baz0", "toto0", "tintin0"], ["foo1", "bar1", "baz1", "toto1", "tintin1"], ["foo2", "bar2", "baz2", "toto2", "tintin2"], ["foo3", "bar3", "baz3", "toto3", "tintin3"], ["foo4", "bar4", "baz4", "toto4", "tintin4"]] self.combo=ListBox() self.list=ListBox() self.echo=Label() self.combo.setVisibleItemCount(1) self.combo.addChangeListener(self) self.list.setVisibleItemCount(10) self.list.setMultipleSelect(True) for i in range(len(self.sStrings)): self.combo.addItem("List " + i) self.combo.setSelectedIndex(0) self.fillList(0) self.list.addChangeListener(self) horz = HorizontalPanel() horz.setVerticalAlignment(HasAlignment.ALIGN_TOP) horz.setSpacing(8) horz.add(self.combo) horz.add(self.list) panel = VerticalPanel() panel.setHorizontalAlignment(HasAlignment.ALIGN_LEFT) panel.add(horz) panel.add(self.echo) self.setWidget(panel) self.echoSelection()
def __init__(self): Sink.__init__(self) disabledButton = Button("Disabled Button") disabledCheck = CheckBox("Disabled Check") normalButton = Button("Normal Button") normalCheck = CheckBox("Normal Check") panel = VerticalPanel() radio0 = RadioButton("group0", "Choice 0") radio1 = RadioButton("group0", "Choice 1") radio2 = RadioButton("group0", "Choice 2 (Disabled)") radio3 = RadioButton("group0", "Choice 3") hp=HorizontalPanel() panel.add(hp) hp.setSpacing(8) hp.add(normalButton) hp.add(disabledButton) hp=HorizontalPanel() panel.add(hp) hp.setSpacing(8) hp.add(normalCheck) hp.add(disabledCheck) hp=HorizontalPanel() panel.add(hp) hp.setSpacing(8) hp.add(radio0) hp.add(radio1) hp.add(radio2) hp.add(radio3) disabledButton.setEnabled(False) disabledCheck.setEnabled(False) radio2.setEnabled(False) panel.setSpacing(8) self.initWidget(panel)
def __init__(self): disabledButton = Button("Disabled Button") disabledCheck = CheckBox("Disabled Check") normalButton = Button("Normal Button") normalCheck = CheckBox("Normal Check") panel = VerticalPanel() radio0 = RadioButton("group0", "Choice 0") radio1 = RadioButton("group0", "Choice 1") radio2 = RadioButton("group0", "Choice 2 (Disabled)") radio3 = RadioButton("group0", "Choice 3") hp = HorizontalPanel() panel.add(hp) hp.setSpacing(8) hp.add(normalButton) hp.add(disabledButton) hp = HorizontalPanel() panel.add(hp) hp.setSpacing(8) hp.add(normalCheck) hp.add(disabledCheck) hp = HorizontalPanel() panel.add(hp) hp.setSpacing(8) hp.add(radio0) hp.add(radio1) hp.add(radio2) hp.add(radio3) disabledButton.setEnabled(False) disabledCheck.setEnabled(False) radio2.setEnabled(False) panel.setSpacing(8) self.setWidget(panel)