List of usage examples for com.google.gwt.user.client.ui HorizontalPanel setHorizontalAlignment
public void setHorizontalAlignment(HorizontalAlignmentConstant align)
From source file:com.dawg6.web.dhcalc.client.AboutDialog.java
License:Open Source License
public AboutDialog() { flexTable = new FlexTable(); flexTable.setBorderWidth(0);/*w w w.j a v a 2 s.c o m*/ flexTable.setCellPadding(5); initWidget(flexTable); Label lblNewLabel = new Label("DH DPS Calculator"); lblNewLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); lblNewLabel.setStyleName("boldText"); lblNewLabel.setWordWrap(false); flexTable.setWidget(0, 0, lblNewLabel); flexTable.getCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP); flexTable.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT); HorizontalPanel horizontalPanel = new HorizontalPanel(); horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); horizontalPanel.setSpacing(5); horizontalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); flexTable.setWidget(1, 0, horizontalPanel); Label lblNewLabel_1 = new Label("Version:"); horizontalPanel.add(lblNewLabel_1); versionLabel = new Label(Version.getVersionString()); horizontalPanel.add(versionLabel); flexTable.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER); HorizontalPanel horizontalPanel_1 = new HorizontalPanel(); horizontalPanel_1.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); horizontalPanel_1.setSpacing(5); horizontalPanel_1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); flexTable.setWidget(3, 0, horizontalPanel_1); Label lblWritteByDawg = new Label("Written By:"); horizontalPanel_1.add(lblWritteByDawg); Anchor label_1 = new Anchor("New label"); label_1.setTarget("_blank"); label_1.setText("dawg6"); label_1.setHref("http://us.battle.net/d3/en/profile/Dawg6-1416/"); horizontalPanel_1.add(label_1); Label lblNewLabel_2 = new Label("("); horizontalPanel_1.add(lblNewLabel_2); Anchor anchor_1 = new Anchor("New label"); anchor_1.setText("scott@dawg6.com"); anchor_1.setTarget("_blank"); anchor_1.setHref("mailto:scott@dawg6.com"); horizontalPanel_1.add(anchor_1); Label lblNewLabel_3 = new Label(")"); horizontalPanel_1.add(lblNewLabel_3); flexTable.getCellFormatter().setHorizontalAlignment(3, 0, HasHorizontalAlignment.ALIGN_CENTER); HorizontalPanel horizontalPanel_2 = new HorizontalPanel(); horizontalPanel_2.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); horizontalPanel_2.setSpacing(5); horizontalPanel_2.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); flexTable.setWidget(5, 0, horizontalPanel_2); Label lblRedditThread = new Label("Reddit Thread:"); horizontalPanel_2.add(lblRedditThread); Anchor anchor = new Anchor("New label"); anchor.setTarget("_blank"); anchor.setText("http://redd.it/2jiynj"); anchor.setHref("http://redd.it/2jiynj"); horizontalPanel_2.add(anchor); flexTable.getCellFormatter().setHorizontalAlignment(5, 0, HasHorizontalAlignment.ALIGN_CENTER); HorizontalPanel horizontalPanel_3 = new HorizontalPanel(); horizontalPanel_3.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); horizontalPanel_3.setSpacing(5); horizontalPanel_3.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); flexTable.setWidget(6, 0, horizontalPanel_3); Label lblBlizzardThread = new Label("Blizzard Thread:"); horizontalPanel_3.add(lblBlizzardThread); Anchor anchor_2 = new Anchor("New label"); anchor_2.setText("http://us.battle.net/d3/en/forum/topic/18706673688"); anchor_2.setTarget("_blank"); anchor_2.setHref("http://us.battle.net/d3/en/forum/topic/18706673688"); horizontalPanel_3.add(anchor_2); flexTable.getCellFormatter().setHorizontalAlignment(6, 0, HasHorizontalAlignment.ALIGN_CENTER); HorizontalPanel horizontalPanel_4 = new HorizontalPanel(); horizontalPanel_4.setSpacing(5); horizontalPanel_4.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); flexTable.setWidget(7, 0, horizontalPanel_4); Anchor anchor_3 = new Anchor("New label"); anchor_3.setText("Change Log"); anchor_3.setTarget("_blank"); anchor_3.setHref("changeLog.txt?v2"); horizontalPanel_4.add(anchor_3); Anchor anchor_4 = new Anchor("New label"); anchor_4.setText("To-do List"); anchor_4.setTarget("_blank"); anchor_4.setHref("https://github.com/dawg6/dhcalc/issues"); horizontalPanel_4.add(anchor_4); flexTable.getCellFormatter().setHorizontalAlignment(7, 0, HasHorizontalAlignment.ALIGN_CENTER); Anchor anchor_5 = new Anchor("Source Code"); anchor_5.setTarget("_blank"); anchor_5.setHref("https://github.com/dawg6/dhcalc"); horizontalPanel_4.add(anchor_5); flexTable.getCellFormatter().setHorizontalAlignment(7, 0, HasHorizontalAlignment.ALIGN_CENTER); }
From source file:com.dawg6.web.dhcalc.client.SavePanel.java
License:Open Source License
public SavePanel() { CaptionPanel captionPanel = new CaptionPanel("Save/Load"); initWidget(captionPanel);// w w w .j a v a 2 s . c o m FlexTable flexTable_3 = new FlexTable(); flexTable_3.setCellPadding(2); captionPanel.setContentWidget(flexTable_3); tabPanel = new TabPanel(); flexTable_3.setWidget(0, 0, tabPanel); browserPanel = new FlexTable(); browserPanel.setCellPadding(2); if (Storage.isLocalStorageSupported()) { tabPanel.add(browserPanel, "Browser Storage", false); } storageList = new ListBox(); browserPanel.setWidget(0, 0, storageList); storageList.setWidth("100%"); storageList.setVisibleItemCount(5); nameField = new TextBox(); nameField.setVisibleLength(30); nameField.setText("Enter a Name"); browserPanel.setWidget(1, 0, nameField); Button btnNewButton = new Button("New button"); browserPanel.setWidget(1, 1, btnNewButton); btnNewButton.setText("Add"); btnNewButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { addLocalStorage(); } }); HorizontalPanel horizontalPanel = new HorizontalPanel(); horizontalPanel.setSpacing(5); horizontalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); browserPanel.setWidget(2, 0, horizontalPanel); Button button_6 = new Button("New button"); button_6.setText("Save"); horizontalPanel.add(button_6); button_6.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { saveLocalStorage(); } }); Button button_5 = new Button("New button"); horizontalPanel.add(button_5); button_5.setText("Restore"); button_5.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { restoreLocalStorage(); } }); Button button_2 = new Button("New button"); horizontalPanel.add(button_2); button_2.setText("Delete"); button_2.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { deleteLocalStorage(); } }); Button btnNewButton_1 = new Button("New button"); horizontalPanel.add(btnNewButton_1); btnNewButton_1.setText("Rename"); btnNewButton_1.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { renameLocalStorage(); } }); browserPanel.getFlexCellFormatter().setColSpan(0, 0, 1); browserPanel.getFlexCellFormatter().setColSpan(2, 0, 1); browserPanel.getFlexCellFormatter().setColSpan(0, 0, 2); browserPanel.getFlexCellFormatter().setColSpan(2, 0, 2); browserPanel.getCellFormatter().setHorizontalAlignment(2, 0, HasHorizontalAlignment.ALIGN_CENTER); filePanel = new FlexTable(); filePanel.setCellPadding(2); tabPanel.add(filePanel, "Local File", false); HorizontalPanel horizontalPanel_1 = new HorizontalPanel(); filePanel.setWidget(0, 0, horizontalPanel_1); loadPanel = new FormPanel(); loadPanel.setMethod(FormPanel.METHOD_POST); loadPanel.setEncoding(FormPanel.ENCODING_MULTIPART); loadPanel.setAction("loadData"); horizontalPanel_1.add(loadPanel); HorizontalPanel horizontalPanel_2 = new HorizontalPanel(); loadPanel.setWidget(horizontalPanel_2); horizontalPanel_2.setSize("100%", "100%"); fileUpload = new FileUpload(); fileUpload.setName("file"); horizontalPanel_2.add(fileUpload); clientKey = new Hidden("client"); horizontalPanel_2.add(clientKey); filePanel.getFlexCellFormatter().setColSpan(0, 0, 1); Button button = new Button("Save Data..."); filePanel.setWidget(1, 0, button); button.setText("Save File"); Button button_1 = new Button("Load Data..."); filePanel.setWidget(1, 1, button_1); button_1.setText("Load File"); filePanel.getFlexCellFormatter().setColSpan(0, 0, 2); filePanel.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER); filePanel.getCellFormatter().setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_CENTER); button_1.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { loadFile(); } }); button.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { saveFile(); } }); textPanel = new FlexTable(); textPanel.setCellPadding(2); tabPanel.add(textPanel, "Copy/Paste", false); textArea = new TextArea(); textArea.setText( "Paste previously saved form data here and click \"Restore.\" Or press \"Current\" to paste current Form data."); textArea.setVisibleLines(5); textPanel.setWidget(0, 0, textArea); textArea.setSize("100%", ""); Button button_3 = new Button("Save Data..."); button_3.setText("Current"); textPanel.setWidget(1, 0, button_3); textArea.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { textArea.selectAll(); } }); nameField.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { nameField.selectAll(); } }); button_3.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (listener != null) { FormData data = listener.getFormData(); JSONObject obj = JsonUtil.toJSONObject(data); textArea.setText(JsonUtil.formatJsonText(obj.toString())); textArea.selectAll(); } } }); Button button_4 = new Button("Load Data..."); button_4.setText("Restore"); button_4.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (listener != null) { String text = textArea.getText(); FormData data = JsonUtil.parseFormData(text); listener.setFormData(data); textArea.setText(""); } } }); textPanel.setWidget(1, 1, button_4); textPanel.getFlexCellFormatter().setColSpan(0, 0, 2); textPanel.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER); textPanel.getCellFormatter().setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_CENTER); flexTable_3.getFlexCellFormatter().setColSpan(0, 0, 1); storageList.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { int i = storageList.getSelectedIndex(); if (i >= 0) { String name = storageList.getItemText(i); if (name != null) nameField.setText(name); } } }); }
From source file:com.ephesoft.dcma.gwt.foldermanager.client.view.FolderTableView.java
License:Open Source License
private void showTableOptions() { folderUploadWidget.setVisible(true); if (multipleSelectionPanel == null) { multipleSelectionPanel = new VerticalPanel(); HorizontalPanel labelPanel = new HorizontalPanel(); Label label = new Label( LocaleDictionary.get().getMessageValue(FolderManagementMessages.MULTI_SELECT_OPTIONS)); labelPanel.add(label);/* www . ja v a2 s .c o m*/ labelPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); multipleSelectionPanel.add(labelPanel); HorizontalPanel multipleSelectionButtonPanel = new HorizontalPanel(); multipleSelectionPanel.add(multipleSelectionButtonPanel); multipleSelectionButtonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); multipleSelectionButtonPanel.add(cut); multipleSelectionButtonPanel.add(copy); multipleSelectionButtonPanel.add(paste); multipleSelectionButtonPanel.add(deleteSelected); multipleSelectionButtonPanel.setSpacing(2); } if (folderPathOperationsPanel == null) { folderPathOperationsPanel = new VerticalPanel(); HorizontalPanel folderLabelPanel = new HorizontalPanel(); Label label = new Label(LocaleDictionary.get().getConstantValue(FolderManagementConstants.FOLDER)); folderLabelPanel.add(label); folderLabelPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); HorizontalPanel folderPathOperationButtonsPanel = new HorizontalPanel(); folderPathOperationButtonsPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); folderPathOperationButtonsPanel.setSpacing(2); createNewFolder.setWidth(_100PX); folderPathOperationButtonsPanel.add(createNewFolder); folderPathOperationButtonsPanel.add(folderUpButton); folderPathOperationButtonsPanel.add(refresh); folderPathOperationsPanel.add(folderLabelPanel); folderPathOperationsPanel.add(folderPathOperationButtonsPanel); } optionsPanel.add(folderPathOperationsPanel); optionsPanel.setCellHorizontalAlignment(folderPathOperationsPanel, HasHorizontalAlignment.ALIGN_LEFT); optionsPanel.add(folderUploadWidget); optionsPanel.setCellHorizontalAlignment(folderUploadWidget, HasHorizontalAlignment.ALIGN_CENTER); optionsPanel.add(multipleSelectionPanel); optionsPanel.setCellHorizontalAlignment(multipleSelectionPanel, HasHorizontalAlignment.ALIGN_RIGHT); optionsPanel.addStyleName(OPTIONS_CSS); }
From source file:com.google.appinventor.client.StatusPanel.java
License:Open Source License
/** * Initializes and assembles all UI elements shown in the status panel. *//*from ww w. j a v a 2 s . c om*/ public StatusPanel() { HorizontalPanel hpanel = new HorizontalPanel(); hpanel.setWidth("100%"); hpanel.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER); String tosUrl = Ode.getInstance().getSystemConfig().getTosUrl(); if (!Strings.isNullOrEmpty(tosUrl)) { String appInventorFooter = "<a href=\"" + tosUrl + "\" target=\"_blank\">" + MESSAGES.privacyTermsLink() + "</a>"; hpanel.add(new HTML(appInventorFooter)); } // This shows the git version and the date of the build // String version = GitBuildId.getVersion(); // String date = GitBuildId.getDate(); // if (version != null && date != null) { // Label buildId = new Label(MESSAGES.gitBuildId(date, version)); // hpanel.add(buildId); // hpanel.setCellHorizontalAlignment(buildId, HorizontalPanel.ALIGN_RIGHT); // } initWidget(hpanel); setStyleName("ode-StatusPanel"); }
From source file:com.google.appinventor.client.widgets.properties.AdditionalChoicePropertyEditor.java
License:Open Source License
/** * Initializes the additional choice panel. * * <p>This method must be called from any implementor's constructor. * * @param panel panel containing additional choices *//*from w w w. jav a2 s .co m*/ protected void initAdditionalChoicePanel(Panel panel) { Button cancelButton = new Button(MESSAGES.cancelButton()); cancelButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { closeAdditionalChoiceDialog(false); } }); Button okButton = new Button(MESSAGES.okButton()); okButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { closeAdditionalChoiceDialog(true); } }); HorizontalPanel buttonPanel = new HorizontalPanel(); buttonPanel.add(cancelButton); buttonPanel.add(okButton); buttonPanel.setWidth("100%"); buttonPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT); VerticalPanel contentPanel = new VerticalPanel(); contentPanel.add(panel); contentPanel.add(buttonPanel); popup = new PopupPanel(false, true); popup.setAutoHideEnabled(true); popup.setWidget(contentPanel); popup.setStylePrimaryName("ode-MultipleChoicePropertyEditor"); }
From source file:com.google.gwt.gears.sample.gwtnote.client.ui.RichTextWidget.java
License:Apache License
/** * Creates a new widget. This class needs access to certain fields and methods * on the application enclosing it.// ww w. ja v a 2 s . c om * * @param parent the host application */ public RichTextWidget(final GWTNote parent) { super(); VerticalPanel top = new VerticalPanel(); top.setWidth("100%"); HorizontalPanel header = new HorizontalPanel(); top.add(header); header.setWidth("100%"); header.add(new Label("GWT GearsNote")); header.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); status = new Label("Ready"); header.add(status); this.bodyWidget = new RichTextArea(); bodyWidget.addKeyboardListener(new KeyboardListenerAdapter() { @Override public void onKeyPress(Widget sender, char keyCode, int modifiers) { String newText = bodyWidget.getText(); if (((newText == null) && (curText != null)) || ((newText != null) && !newText.equals(curText))) { curText = newText; } } }); HorizontalPanel controls = new HorizontalPanel(); RichTextToolbar tb = new RichTextToolbar(this.bodyWidget); name = new TextBox(); name.setText("default"); name.setEnabled(false); nameEdit = new PushButton("Edit"); nameEdit.addClickListener(new ClickListener() { public void onClick(Widget sender) { String curName = name.getText(); boolean doNotify = !oldName.equals(curName); if (!nameEditable) { // if becoming editable, store off current value oldName = curName; } if (nameEditable && (curName == null || "".equals(curName))) { // if becoming un-editable, check to make sure it's valid Window.alert("The note name cannot be blank. Please try again."); nameEdit.setText(oldName); return; } // if all else is good, just flip the state nameEditable = !nameEditable; name.setEnabled(nameEditable); nameEdit.getUpFace().setText((nameEditable ? "Confirm" : "Edit")); if (doNotify) { notifyNameListeners(); } } }); nameEdit.addStyleName("edit-button"); options = new ListBox(); controls.add(tb); options.addItem("default"); options.setSelectedIndex(0); options.addChangeListener(new ChangeListener() { public void onChange(Widget sender) { String newName = options.getItemText(options.getSelectedIndex()); name.setText(newName); notifyNameListeners(); } }); HorizontalPanel tmp = new HorizontalPanel(); tmp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); tmp.add(new Label("Note name:")); tmp.add(name); tmp.add(nameEdit); tmp.add(options); controls.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); controls.setWidth("100%"); controls.add(tmp); top.add(controls); top.add(bodyWidget); this.bodyWidget.setWidth("100%"); top.setCellHeight(bodyWidget, ((int) (Window.getClientHeight() * .75)) + "px"); this.bodyWidget.setHeight("100%"); initWidget(top); }
From source file:com.google.gwt.gears.sample.workerpool.client.AnimationToy.java
License:Apache License
/** * Create an options panel that allows users to select a widget and reposition * it.//from w ww . j ava2s . c om * * @return the new options panel */ private Widget createOptionsBar() { // Create a panel to move components around HorizontalPanel optionsBar = new HorizontalPanel(); optionsBar.setSpacing(5); optionsBar.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); // Add a title optionsBar.add(new HTML("<b>Animate Logos</b>")); // Add start button startButton = new Button("Start"); startButton.addClickListener(new ClickListener() { public void onClick(Widget sender) { animation.run(2000); } }); optionsBar.add(startButton); // Add cancel button cancelButton = new Button("Cancel"); cancelButton.addClickListener(new ClickListener() { public void onClick(Widget sender) { animation.cancel(); } }); optionsBar.add(cancelButton); // Return the options bar return optionsBar; }
From source file:com.google.gwt.gears.sample.workerpooldemo.client.AnimationToy.java
License:Apache License
/** * Create an options panel that allows users to select a widget and reposition * it./*from www . j ava2 s. c o m*/ * * @return the new options panel */ private Widget createOptionsBar() { // Create a panel to move components around HorizontalPanel optionsBar = new HorizontalPanel(); optionsBar.setSpacing(5); optionsBar.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); // Add a title optionsBar.add(new HTML("<b>Animate Logos</b>")); // Add start button startButton = new Button("Start"); startButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { animation.run(2000); } }); optionsBar.add(startButton); // Add cancel button cancelButton = new Button("Cancel"); cancelButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { animation.cancel(); } }); optionsBar.add(cancelButton); // Return the options bar return optionsBar; }
From source file:com.google.gwt.maps.sample.hellomaps.client.DrawingOverlayDemo.java
License:Apache License
private DialogBox makeAddPolyDialog() { DialogBox dialog = new DialogBox(); dialog.setTitle("Add Polyline"); Grid grid = new Grid(2, 4); VerticalPanel vp = new VerticalPanel(); grid.setHTML(0, 0, "<b>Opacity</b>"); // The drop down lists for setting the style final ListBox opacityBox = new ListBox(); for (int i = 100; i > 0; i -= 10) { opacityBox.addItem(i + "%"); }//from w w w . j a v a2 s. co m opacityBox.addChangeListener(new ChangeListener() { public void onChange(Widget sender) { String val = opacityBox.getItemText(opacityBox.getSelectedIndex()); opacity = Double.parseDouble(val.replace("%", "")) / 100.0; } }); grid.setWidget(1, 0, opacityBox); grid.setHTML(0, 1, "<b>Weight</b>"); final ListBox weightBox = new ListBox(); weightBox.addItem("1 pixel"); weightBox.addItem("2 pixels"); weightBox.addItem("3 pixels"); weightBox.addItem("5 pixels"); weightBox.addItem("10 pixels"); weightBox.addChangeListener(new ChangeListener() { public void onChange(Widget sender) { String val = weightBox.getItemText(weightBox.getSelectedIndex()); val = val.replace(" pixel", ""); val = val.replace("s", ""); weight = Integer.parseInt(val); } }); grid.setWidget(1, 1, weightBox); grid.setHTML(0, 2, "<b>Color</b>"); final ListBox colorBox = new ListBox(); colorBox.addItem("#FF0000 red"); colorBox.addItem("#FFFF00 yellow"); colorBox.addItem("#00FF00 green"); colorBox.addItem("#00FFFF cyan"); colorBox.addItem("#0000FF blue"); colorBox.addItem("#FF00FF violet"); colorBox.addChangeListener(new ChangeListener() { public void onChange(Widget sender) { color = colorBox.getItemText(colorBox.getSelectedIndex()).substring(0, 7); } }); grid.setWidget(1, 2, colorBox); grid.setHTML(0, 3, "<b>Fill Polygon</b>"); final CheckBox fillCheckBox = new CheckBox(""); fillCheckBox.addClickListener(new ClickListener() { public void onClick(Widget sender) { fillFlag = fillCheckBox.isChecked(); } }); grid.setWidget(1, 3, fillCheckBox); Button addPolylineButton = new Button("Make Polyline"); addPolylineButton.addClickListener(new ClickListener() { public void onClick(Widget sender) { message1.setText("opacity=" + opacity + " color=" + color + " weight=" + weight + " polygon=" + makePolygon + " center=" + map.getCenter() + " zoom=" + map.getZoomLevel()); addPolyDialog.hide(); createPolyline(); editPolylineButton.setEnabled(true); } }); Button addPolygonButton = new Button("Make Polygon"); addPolygonButton.addClickListener(new ClickListener() { public void onClick(Widget sender) { message1.setText( "Opacity=" + opacity + " color=" + color + "weight=" + weight + "polygon = " + makePolygon + "Center=" + map.getCenter() + " zoom=" + map.getZoomLevel() + "fill=" + fillFlag); addPolyDialog.hide(); createPolygon(); editPolygonButton.setEnabled(true); } }); Button cancelButton = new Button("Cancel"); cancelButton.addClickListener(new ClickListener() { public void onClick(Widget sender) { addPolyDialog.hide(); } }); HorizontalPanel buttonPanel = new HorizontalPanel(); buttonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); buttonPanel.add(addPolylineButton); buttonPanel.add(addPolygonButton); buttonPanel.add(cancelButton); vp.add(grid); vp.add(buttonPanel); dialog.add(vp); return dialog; }
From source file:com.google.gwt.sample.dynatable.client.DayFilterWidget.java
License:Apache License
public DayFilterWidget(SchoolCalendarWidget calendar) { this.calendar = calendar; initWidget(outer);/*from ww w.j ava 2 s . co m*/ setStyleName("DynaTable-DayFilterWidget"); outer.add(new DayCheckBox("Sunday", 0)); outer.add(new DayCheckBox("Monday", 1)); outer.add(new DayCheckBox("Tuesday", 2)); outer.add(new DayCheckBox("Wednesday", 3)); outer.add(new DayCheckBox("Thursday", 4)); outer.add(new DayCheckBox("Friday", 5)); outer.add(new DayCheckBox("Saturday", 6)); Button buttonAll = new Button("All", new ClickHandler() { public void onClick(ClickEvent event) { setAllCheckBoxes(true); } }); Button buttonNone = new Button("None", new ClickHandler() { public void onClick(ClickEvent event) { setAllCheckBoxes(false); } }); HorizontalPanel hp = new HorizontalPanel(); hp.setHorizontalAlignment(HasAlignment.ALIGN_CENTER); hp.add(buttonAll); hp.add(buttonNone); outer.add(hp); outer.setCellVerticalAlignment(hp, HasAlignment.ALIGN_BOTTOM); outer.setCellHorizontalAlignment(hp, HasAlignment.ALIGN_CENTER); }