def __init__(self, autoHide=None, modal=True, centered=False, **kwargs): # Init section self.dragging = False self.dragStartX = 0 self.dragStartY = 0 self.child = None self.panel = FlexTable( Height="100%", BorderWidth="0", CellPadding="0", CellSpacing="0", ) cf = self.panel.getCellFormatter() cf.setHeight(1, 0, "100%") cf.setWidth(1, 0, "100%") cf.setAlignment( 1, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE, ) # Arguments section self.modal = modal self.caption = HTML() self.panel.setWidget(0, 0, self.caption) self.caption.setStyleName("Caption") self.caption.addMouseListener(self) # Finalize kwargs['StyleName'] = kwargs.get('StyleName', "gwt-DialogBox") PopupPanel.__init__(self, autoHide, modal, **kwargs) PopupPanel.setWidget(self, self.panel) self.centered = centered
def __init__(self, left=50, top=50): DialogBox.__init__(self, modal=False) self.setPopupPosition(left, top) self.setText("Preferences") ftable = FlexTable() ftableFormatter = ftable.getFlexCellFormatter() row = 0 try: self.fileLocation = getCookie("fileLocation") except: self.fileLocation = None row += 1 ftable.setWidget(row, 0, Label("Sheet loaded on startup", wordWrap=False)) self.fileLocationInput = TextBox() self.fileLocationInput.addChangeListener(self.checkValid) self.fileLocationInput.addKeyboardListener(self) self.fileLocationInput.setVisibleLength(30) self.fileLocationInput.setText(self.fileLocation) ftable.setWidget(row, 1, self.fileLocationInput) row += 1 hpanel = HorizontalPanel() self.saveBtn = Button("Save", self.onSave) self.saveBtn.setEnabled(False) hpanel.add(self.saveBtn) self.cancelBtn = Button("Cancel", self.onCancel) hpanel.add(self.cancelBtn) ftable.setWidget(row, 0, hpanel) ftableFormatter.setColSpan(row, 0, 2) self.setWidget(ftable)
def __init__(self): SimplePanel.__init__(self) self._table = FlexTable(BorderWidth=1, Width="100%") cellFormatter = self._table.getFlexCellFormatter() rowFormatter = self._table.getRowFormatter() self._table.setHTML(0, 0, "<b>Mammals</b>") self._table.setText(1, 0, "Cow") self._table.setText(1, 1, "Rat") self._table.setText(1, 2, "Dog") cellFormatter.setColSpan(0, 0, 3) cellFormatter.setHorizontalAlignment(0, 0, HasAlignment.ALIGN_CENTER) self._table.setWidget(2, 0, Button("Hide", getattr(self, "hideRows"))) self._table.setText(2, 1, "1,1") self._table.setText(2, 2, "2,1") self._table.setText(3, 0, "1,2") self._table.setText(3, 1, "2,2") cellFormatter.setRowSpan(2, 0, 2) cellFormatter.setVerticalAlignment(2, 0, HasAlignment.ALIGN_MIDDLE) self._table.setWidget(4, 0, Button("Show", getattr(self, "showRows"))) cellFormatter.setColSpan(4, 0, 3) rowFormatter.setVisible(4, False) self.add(self._table)
def __init__(self,parent): AbsolutePanel.__init__(self) ftable = FlexTable() ftable.setWidget(0, 0, Label("First Name", wordWrap=False)) ftableFormatter = ftable.getFlexCellFormatter() self.firstInput = TextBox() self.firstInput.addChangeListener(self.checkValid) self.firstInput.addKeyboardListener(self) ftable.setWidget(0, 1, self.firstInput) ftable.setWidget(1, 0, Label("Last Name", wordWrap=False)) self.lastInput = TextBox() self.lastInput.addChangeListener(self.checkValid) self.lastInput.addKeyboardListener(self) ftable.setWidget(1, 1, self.lastInput) ftable.setWidget(2, 0, Label("Email", wordWrap=False)) self.emailInput = TextBox() self.emailInput.addChangeListener(self.checkValid) self.emailInput.addKeyboardListener(self) ftable.setWidget(2, 1, self.emailInput) ftable.setWidget(3, 0, Label("Username", wordWrap=False)) self.usernameInput = TextBox() self.usernameInput.addChangeListener(self.checkValid) self.usernameInput.addKeyboardListener(self) ftable.setWidget(3, 1, self.usernameInput) ftable.setWidget(4, 0, Label("Password", wordWrap=False)) self.passwordInput = PasswordTextBox() self.passwordInput.addChangeListener(self.checkValid) self.passwordInput.addKeyboardListener(self) ftable.setWidget(4, 1, self.passwordInput) ftable.setWidget(5, 0, Label("Confirm", wordWrap=False)) self.confirmInput = PasswordTextBox() self.confirmInput.addChangeListener(self.checkValid) self.confirmInput.addKeyboardListener(self) ftable.setWidget(5, 1, self.confirmInput) ftable.setWidget(6, 0, Label("Department", wordWrap=False)) self.departmentCombo = ListBox() self.departmentCombo.addChangeListener(self.checkValid) self.departmentCombo.addKeyboardListener(self) ftable.setWidget(6, 1, self.departmentCombo) hpanel = HorizontalPanel() self.addBtn = Button("Add User") self.addBtn.setEnabled(False) hpanel.add(self.addBtn) self.cancelBtn = Button("Cancel") hpanel.add(self.cancelBtn) ftable.setWidget(7, 0, hpanel) ftableFormatter.setColSpan(7, 0, 2) self.add(ftable) return
def __init__(self): self.DPanel = DockPanel(HorizontalAlignment = HasAlignment.ALIGN_CENTER, Spacing=10) # Creates the Docker Panel Instance self.VPanel = VerticalPanel() # Creates the Vertical Panel Instance self.VPanel1 = VerticalPanel() # Creates the Vertical Panel Instance self.HPanel = HorizontalPanel() # Creates a Horizontal Panel Instance self.HPanel1 = HorizontalPanel()# Creates a Horizontal Panel Instance self.image=Image()#Creates the Image instance to embed the images of dice self.DummyUrl = self.image.getUrl() self.timer = Timer(notify=self.StillImage)#Timer for display of gif animation self.timerRButton = Timer(notify=self.OneAlert)#Timer for controlling states of Roll button #whenever the output of the dice is 1 self.RollButton = Button("Roll", getattr(self, "RollButtonPressed")) #Initially Disabled self.RollButton.setEnabled(False) self.BankButton = Button("Bank", getattr(self, "BankButtonPressed")) #Initially Disabled self.BankButton.setEnabled(False) #The start button controls both the number players as well the winning score self.StartButton = Button("Start", getattr(self, "StartButtonPressed")) #Intially Enabled self.StartButton.setEnabled(True) self.PlayerNum = TextBox() #Enter the Number of Players self.WinScore = TextBox() #Enter the Target Score self.PlayerNum.setText("0") self.WinScore.setText("0") # self.OK = Button("OK", getattr(self, "okButtonPressed")) self.NameScore = FlexTable() #main score board self.NameScore.setStyleName("NameScore") self.TempBoard = FlexTable() #Temporary score board self.TempBoard.setStyleName("TempBoard") self.TxtInstructions = HTML()
def __init__(self, title): DockPanel.__init__(self) self.grid = FlexTable() title = HTML(title) self.add(title, DockPanel.NORTH) self.setCellHorizontalAlignment(title, HasHorizontalAlignment.ALIGN_LEFT) self.add(self.grid, DockPanel.CENTER) self.grid.setBorderWidth("0px") self.grid.setCellSpacing("0px") self.grid.setCellPadding("4px") self.formatCell(0, 0) self.grid.setHTML(0, 0, " ")
def __init__(self, sink): SimplePanel.__init__(self) self.sink = sink self.caption = HTML() self.child = None self.showing = False self.dragging = False self.dragStartX = 0 self.dragStartY = 0 self.panel = FlexTable() self.collapse = Image("./images/cancel.png") self.collapse.addClickListener(self) dock = DockPanel() dock.setSpacing(0) dock.add(self.collapse, DockPanel.EAST) dock.add(self.caption, DockPanel.WEST) dock.setCellHorizontalAlignment(self.collapse, HasAlignment.ALIGN_RIGHT) dock.setCellVerticalAlignment(self.collapse, HasAlignment.ALIGN_TOP) dock.setCellHorizontalAlignment(self.caption, HasAlignment.ALIGN_LEFT) dock.setCellWidth(self.caption, "100%") dock.setWidth("100%") dock.setHeight("100%") self.panel.setWidget(0, 0, dock) self.panel.setHeight("100%") self.panel.setWidth("100%") self.panel.setBorderWidth(0) self.panel.setCellPadding(0) self.panel.setCellSpacing(0) self.panel.getCellFormatter().setHeight(1, 0, "100%") self.panel.getCellFormatter().setWidth(1, 0, "100%") self.panel.getCellFormatter().setAlignment( 1, 0, HasHorizontalAlignment.ALIGN_LEFT, HasVerticalAlignment.ALIGN_TOP) SimplePanel.setWidget(self, self.panel) self.setStyleName("gwt-DialogBox") self.caption.setStyleName("Caption") self.collapse.setStyleName("Close") dock.setStyleName("Header") #self.caption.addMouseListener(self) self.collapsed = False self.collapsed_width = "15px" self.uncollapsed_width = "100%"
def __init__(self): Sink.__init__(self) inner = Grid(10, 5, Width="100%", BorderWidth="1") outer = FlexTable(Width="100%", BorderWidth="1") outer.setWidget(0, 0, Image(self.baseURL() + "rembrandt/LaMarcheNocturne.jpg")) outer.getFlexCellFormatter().setColSpan(0, 0, 2) outer.getFlexCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER) outer.setHTML(1, 0, "Look to the right...<br>That's a nested table component ->") outer.setWidget(1, 1, inner) outer.getCellFormatter().setColSpan(1, 1, 2) for i in range(10): for j in range(5): inner.setText(i, j, "%d" % i + ",%d" % j) self.initWidget(outer)
def __init__(self, identifier, autoHide=None, modal=False, rootpanel=None): PopupPanel.__init__(self, autoHide, modal, rootpanel) self.identifier = identifier self.caption = HTML() self.child = None self.showing = False self.dragging = False self.dragStartX = 0 self.dragStartY = 0 self.panel = FlexTable() self.closeButton = Image("images/cancel.png") self.closeButton.addClickListener(self) dock = DockPanel() dock.setSpacing(0) dock.add(self.closeButton, DockPanel.EAST) dock.add(self.caption, DockPanel.WEST) dock.setCellHorizontalAlignment(self.closeButton, HasAlignment.ALIGN_RIGHT) dock.setCellHorizontalAlignment(self.caption, HasAlignment.ALIGN_LEFT) dock.setCellWidth(self.caption, "100%") dock.setWidth("100%") self.panel.setWidget(0, 0, dock) self.panel.setHeight("100%") self.panel.setBorderWidth(0) self.panel.setCellPadding(0) self.panel.setCellSpacing(0) self.panel.getCellFormatter().setHeight(1, 0, "100%") self.panel.getCellFormatter().setWidth(1, 0, "100%") #self.panel.getCellFormatter().setAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE) PopupPanel.setWidget(self, self.panel) self.setStyleName("gwt-DialogBox") self.caption.setStyleName("Caption") self.closeButton.setStyleName("Close") dock.setStyleName("Header") self.caption.addMouseListener(self)
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.setSpacing(8) innerNavBar.add(self.newerButton) innerNavBar.add(self.countLabel) innerNavBar.add(self.olderButton) self.navBar.setStyleName("mail-ListNavBar") 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, chart): """ DialogBox CSS Style self.settings used with this example for reference: Note: These simplified CSS styles make the dialog's title bar behave a little quirkily in IE6 when dragging. For more sophisticated CSS that fixes this problem (and also provides a more professional look) see the CSS tab of the DialogBox example in the GWT <a href="xxx"> Showcase of Features</a> (I just didn't want to copy 5 pages of obscure DialogBox CSS into what is after all a Client-side GChart example). .gwt-DialogBox .Caption { font-size: 18 color: #eef background: #00f repeat-x 0px -2003px padding: 4px 4px 4px 8px cursor: default border-bottom: 2px solid #008 border-top: 3px solid #448 .gwt-DialogBox .dialogContent { border: 1px solid #008 background: #ddd padding: 3px """ DialogBox.__init__(self, autoHide=True, modal=True) self.chart = chart self.isFirstTime = True mainPanel = VerticalPanel() propertyForm = FlexTable() commandBar = DockPanel() sliceSwitcher = HorizontalPanel() self.prevSlice = Button("<Prev Slice", self) self.nextSlice = Button("Next Slice>", self) self.closeButton = Button("Close", self) self.chart.colorSelector.addChangeListener(self) self.chart.sliceSizeSelector.addChangeListener(self) self.chart.shadingSelector.addChangeListener(self) #self.prevSlice.addClickListener(self) #self.nextSlice.addClickListener(self) #self.closeButton.addClickListener(self) # slice properties table (slice color, shading and size) propertyForm.setSize(3, 2) propertyForm.setText(0, 0, "Color:") propertyForm.setWidget(0, 1, self.chart.colorSelector) propertyForm.setText(1, 0, "Shading Pattern:") propertyForm.setWidget(1, 1, self.chart.shadingSelector) propertyForm.setText(2, 0, "Slice Size:") propertyForm.setWidget(2, 1, self.chart.sliceSizeSelector) # add additional properties here, if desired # buttons for changing the selected slice from the form sliceSwitcher.add(self.prevSlice) sliceSwitcher.add(self.nextSlice) commandBar.add(sliceSwitcher, DockPanel.WEST) commandBar.add(self.closeButton, DockPanel.EAST) commandBar.setCellHorizontalAlignment( self.closeButton, HasHorizontalAlignment.ALIGN_RIGHT) commandBar.setWidth("100%") # pushes close button to right edge # create main form and place it in DialogBox mainPanel.add(propertyForm) mainPanel.add(commandBar) self.setWidget(mainPanel)