List of usage examples for com.google.gwt.user.client.ui RadioButton RadioButton
@UiConstructor
public RadioButton(String name)
From source file:ar.com.cristal.creditos.client.clientes.busqueda.BusquedaClientesActivity.java
License:Open Source License
private void mostrarVacas(final FlexTable tabla, List<VacaDTO> vacas) { int i = 0;/* w w w . j a va2s .c o m*/ view.initTable(); if (vacas.isEmpty()) { popup.mostrarMensaje("No se encontr ningn animal con la bsqueda ingresada."); } if (vacas.size() > 5) { view.divTabla.setAttribute("class", "divScroll"); } else { view.divTabla.setAttribute("class", "divNoScroll"); } for (VacaDTO v : vacas) { final RadioButton radio = new RadioButton("busquedaClientesGroup"); radio.addClickHandler(new ClickHandler() { public void onClick(ClickEvent e) { String idCli = view.obtenerIdSeleccionado(); } }); tabla.setWidget(i + 1, 0, radio); tabla.setText(i + 1, 1, v.getRp()); tabla.setText(i + 1, 2, v.getRc()); tabla.setText(i + 1, 3, v.getRodeo_id().toString()); tabla.setText(i + 1, 4, v.getEstadoReproductivo().name()); tabla.setText(i + 1, 5, v.getEstadoProductivo().name()); tabla.setText(i + 1, 6, "ultimo parto!"); tabla.setText(i + 1, 7, v.getFechaUltimoServicio() == null ? "" : v.getFechaUltimoServicio().toString()); tabla.setText(i + 1, 8, v.getId().toString()); tabla.getCellFormatter().setVisible(i + 1, 8, false); if (i % 2 == 0) { tabla.getRowFormatter().addStyleName(i + 1, ConstantesView.ESTILO_FILA1_PUNTERO); } else { tabla.getRowFormatter().addStyleName(i + 1, ConstantesView.ESTILO_FILA2_PUNTERO); } i++; } /* if (vacas.size() == 1){ view.seleccionarUnicoCliente(); } */ }
From source file:at.ait.dme.yuma.client.map.explore.KMLOverlayPanel.java
License:EUPL
private HorizontalPanel createRadioButton(final String kml, String label, boolean preselected) { HorizontalPanel panel = new HorizontalPanel(); RadioButton radio = new RadioButton(RADIO_GROUP); radio.setValue(preselected);/* w ww. j ava 2s . c o m*/ radio.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (kml != null) { kmlLayer.showKml(kml); } else { kmlLayer.hideKml(); } } }); panel.add(radio); panel.add(new InlineHTML(label)); return panel; }
From source file:co.fxl.gui.gwt.GWTContainer.java
License:Open Source License
@Override public IRadioButton radioButton() { setComponent((T) new RadioButton(GWTRadioButton.nextGroup())); return (IRadioButton) (element = new GWTRadioButton((GWTContainer<RadioButton>) this)); }
From source file:com.dimdim.conference.ui.user.client.ChangePictureDialog.java
License:Open Source License
protected Widget getContent() { VerticalPanel contentPanel = new VerticalPanel(); contentPanel.setStyleName("change-photo-content-panel"); String defaultPhotoUrl = UserGlobals.getUserGlobals().getDefaultPhotoUrl(); String currentPhotoUrl = this.me.getPhotoUrl(); //Window.alert("inside chage picture"); this.defaultPhotoButton = new RadioButton("PhotoSelection"); this.defaultPhotoButton.addClickListener(this); this.defaultPhotoButton.setStyleName("change-photo-radio-button"); this.customPhotoButton = new RadioButton("PhotoSelection"); this.customPhotoButton.addClickListener(this); this.customPhotoButton.setStyleName("change-photo-radio-button"); // Custom Photo caption Label comment1 = new Label(UserGlobals.getUserGlobals().getChangePictureComment1()); comment1.setStyleName("change-photo-picture-caption"); comment1.addStyleName("common-text"); contentPanel.add(comment1);/*www.j a va 2s. co m*/ Label comment2 = new Label(UserGlobals.getUserGlobals().getChangePictureComment2()); comment2.setStyleName("change-photo-picture-caption"); comment2.addStyleName("common-text"); contentPanel.add(comment2); HorizontalPanel customPhotoCaption = new HorizontalPanel(); customPhotoCaption.setStyleName("change-photo-picture-caption"); customPhotoCaption.add(this.customPhotoButton); Label label2 = new Label(UIStrings.getChangePhotoLabel()); label2.setStyleName("common-text"); label2.addStyleName("change-photo-label"); customPhotoCaption.add(label2); // HorizontalPanel uploadCaption = new HorizontalPanel(); // uploadCaption.setStyleName("change-photo-picture-caption"); // this.uploadLink = new Label("Upload"); // this.uploadLink.addClickListener(this); // this.uploadLink.setStyleName("common-text"); // this.uploadLink.addStyleName("change-photo-upload-label"); // this.uploadLink.addStyleName("common-anchor"); // uploadCaption.add(this.uploadLink); // Create a form panel for the photo file upload. this.photoUploadForm = new FormPanel(); this.photoUploadForm.setAction(this.commandURLFactory.getPhotoUploadURL()); this.photoUploadForm.setEncoding(FormPanel.ENCODING_MULTIPART); this.photoUploadForm.setMethod(FormPanel.METHOD_POST); this.photoUploadField = new FileUpload(); this.photoUploadField.setName("photo"); this.photoUploadForm.add(this.photoUploadField); this.photoUploadField.setStyleName("photo-file-upload-field"); contentPanel.add(customPhotoCaption); contentPanel.add(this.photoUploadForm); // contentPanel.add(uploadCaption); // Default Photo Caption HorizontalPanel defaultPhotoCaption = new HorizontalPanel(); defaultPhotoCaption.setStyleName("change-photo-picture-caption"); defaultPhotoCaption.add(this.defaultPhotoButton); Label label1 = new Label(UIStrings.getUseDefaultPhotoLabel()); label1.setStyleName("common-text"); label1.addStyleName("change-photo-label"); defaultPhotoCaption.add(label1); if (UserGlobals.getUserGlobals().isPhotoUrlDefault(currentPhotoUrl)) { this.defaultPhotoButton.setChecked(true); this.customPhotoButton.setChecked(false); } else { this.defaultPhotoButton.setChecked(false); this.customPhotoButton.setChecked(true); } contentPanel.add(defaultPhotoCaption); // Photo Panel if (currentPhotoUrl == null || currentPhotoUrl.length() == 0) { currentPhotoUrl = defaultPhotoUrl; } Image photoImage = new Image(currentPhotoUrl); photoImage.setStyleName("change-photo-picture"); contentPanel.add(photoImage); contentPanel.setCellVerticalAlignment(photoImage, VerticalPanel.ALIGN_MIDDLE); contentPanel.setCellHorizontalAlignment(photoImage, HorizontalPanel.ALIGN_LEFT); // this.photoUploadField.setVisible(false); // this.uploadLink.setVisible(false); return contentPanel; }
From source file:com.dimdim.conference.ui.user.client.meetinglobby.MeetingLobbyControlPanel.java
License:Open Source License
protected Widget getContent() { ScrollPanel scroller = new ScrollPanel(); scroller.setStyleName("list-popup-scroll-panel"); VerticalPanel table = new VerticalPanel(); scrolledTable = new VerticalPanel(); scroller.add(scrolledTable);//from www.ja va 2 s.com // table.setStyleName("list-control-table"); HorizontalPanel header = new HorizontalPanel(); header.add(createLabel(".", "user-image-header")); header.add(createLabel(UIStrings.getNameLabel(), "lobby-name")); header.add(createLabel(UIStrings.getEmailLabel(), "lobby-email")); Label accept = createLabel(UIStrings.getAcceptLabel(), "user-chat-button-header"); accept.addStyleName("common-anchor"); accept.addClickListener(this.acceptList); header.add(accept); Label deny = createLabel(UIStrings.getDenyLabel(), "user-chat-button-header"); deny.addStyleName("common-anchor"); deny.addClickListener(this.denyList); header.add(deny); header.addStyleName("common-dialog-row"); table.add(header); table.add(scroller); table.setCellWidth(scroller, "100%"); int size = this.listModel.getListSize(); int i = 0; for (i = 0; i < size; i++) { UserListEntry ule = (UserListEntry) this.listModel.getListEntryAt(i); UIRosterEntry user = ule.getUser(); this.users.addElement(user); HorizontalPanel row = new HorizontalPanel(); HorizontalPanel hp1 = new HorizontalPanel(); Image image = ule.getImage1Url(); hp1.add(image); hp1.setCellHorizontalAlignment(image, HorizontalPanel.ALIGN_CENTER); hp1.setCellVerticalAlignment(image, VerticalPanel.ALIGN_MIDDLE); hp1.setStyleName("user-image"); row.add(hp1); row.setCellHorizontalAlignment(hp1, HorizontalPanel.ALIGN_CENTER); row.setCellVerticalAlignment(hp1, VerticalPanel.ALIGN_MIDDLE); // table.setWidget((i+1), 0, image); Label nameLabel = createTextHTML(user.getDisplayName(), "lobby-name"); nameLabel.addStyleName("common-anchor"); row.add(nameLabel); Label emailLabel = createTextHTML(user.getUserId(), "lobby-email"); emailLabel.addStyleName("common-anchor"); row.add(emailLabel); HorizontalPanel hp3 = new HorizontalPanel(); // CheckBox cb2 = new CheckBox(); RadioButton cb2 = new RadioButton(user.getUserId()); hp3.add(cb2); hp3.setStyleName("user-chat-button"); hp3.setCellHorizontalAlignment(cb2, HorizontalPanel.ALIGN_LEFT); hp3.setCellVerticalAlignment(cb2, VerticalPanel.ALIGN_MIDDLE); row.add(hp3); row.setCellHorizontalAlignment(hp3, HorizontalPanel.ALIGN_LEFT); row.setCellVerticalAlignment(hp3, VerticalPanel.ALIGN_MIDDLE); this.acceptBoxes.addElement(cb2); this.acceptList.addRadioButton(cb2); HorizontalPanel hp4 = new HorizontalPanel(); // CheckBox cb3 = new CheckBox(); RadioButton cb3 = new RadioButton(user.getUserId()); hp4.add(cb3); hp4.setStyleName("user-chat-button"); hp4.setCellHorizontalAlignment(cb3, HorizontalPanel.ALIGN_LEFT); hp4.setCellVerticalAlignment(cb3, VerticalPanel.ALIGN_MIDDLE); row.add(hp4); row.setCellHorizontalAlignment(hp4, HorizontalPanel.ALIGN_LEFT); row.setCellVerticalAlignment(hp4, VerticalPanel.ALIGN_MIDDLE); this.denyBoxes.addElement(cb3); this.denyList.addRadioButton(cb3); row.addStyleName("common-dialog-row"); scrolledTable.add(row); this.rows.addElement(row); } return table; }
From source file:com.ephesoft.dcma.gwt.core.client.ui.table.Table.java
License:Open Source License
private void update(boolean isRadioButton, int startIndex, int selectedIndexlocal) { selectedRowId = null;//from www. j a v a 2s . c o m flexTable.removeAllRows(); navBarTable.removeAllRows(); createTableHeader(isRadioButton); int count = totalCount; int max = startIndex + visibleRecodrCount; if (max > count) { max = count; } navBar.update(startIndex, count, max); setNavigationBar(); TableHeader header = tableData.getHeader(); HeaderColumn[] columns = header.getHeaderColumns(); String width = null; int rowCounter = 0; String radioName = String.valueOf(new Date().getTime()); final List<Record> recordList = tableData.getRecordList(); if (recordList != null) { if (!recordList.isEmpty()) { for (final Record record : recordList) { int colCounter = 0; for (; colCounter < columns.length; colCounter++) { width = columns[colCounter].getWidth() + "%"; flexTable.getCellFormatter().setWidth(rowCounter, colCounter, width); flexTable.setWidget(rowCounter, colCounter, record.getWidget(columns[colCounter])); flexTable.getCellFormatter().setHorizontalAlignment(rowCounter, colCounter, HasHorizontalAlignment.ALIGN_LEFT); flexTable.getCellFormatter().setWordWrap(rowCounter, colCounter, true); flexTable.getCellFormatter().addStyleName(rowCounter, colCounter, "wordWrap"); } if (isRadioButton) { final RadioButton radioButton = new RadioButton(radioName); if (rowCounter == selectedIndexlocal) { radioButton.setValue(true); selectedRowId = record.getIdentifier(); selectedIndex = rowCounter; if (null != listner && fireEventForFirstRow) { listner.onRowSelected(selectedRowId); } scrollIntoView( flexTable.getWidget(selectedIndexlocal, FIRST_COLUMN_INDEX).getElement()); } radioButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { clearRadioButtons(); radioButton.setValue(true); selectedRowId = record.getIdentifier(); selectedIndex = recordList.indexOf(record); } }); flexTable.setWidget(rowCounter, 0, radioButton); RadioButtonContainer radioButtonContainer = new RadioButtonContainer(radioButton, record.getIdentifier()); radioButtons.put(rowCounter, radioButtonContainer); flexTable.getCellFormatter().setHorizontalAlignment(rowCounter, 0, HasHorizontalAlignment.ALIGN_CENTER); radioButton.addFocusHandler(new FocusHandler() { @Override public void onFocus(FocusEvent arg0) { removeSelectedRowStyleFromTable(); for (Integer rowId : radioButtons.keySet()) { if (radioButtons.get(rowId).getRadioButton().equals(radioButton)) { selectedIndex = recordList.indexOf(record); flexTable.getRowFormatter().addStyleName(rowId, selectionStyle.rowHighlighted()); } } } }); } else { RadioButtonContainer radioButtonContainer = new RadioButtonContainer(null, record.getIdentifier()); radioButtons.put(rowCounter, radioButtonContainer); } if (rowCounter % 2 == 0) { flexTable.getRowFormatter().setStyleName(rowCounter, selectionStyle.oddRow()); } else { flexTable.getRowFormatter().setStyleName(rowCounter, selectionStyle.evenRow()); } rowCounter++; flexTable.getRowFormatter().addStyleName(selectedIndexlocal, selectionStyle.rowHighlighted()); } } else { Label label = new Label(); label.setWidth("100%"); label.setText("No record found."); flexTable.getCellFormatter().setWidth(1, 0, "100%"); flexTable.getFlexCellFormatter().setColSpan(1, 0, 3); // Record record = new Record("1"); // tableData.getRecordList().add(record); flexTable.setWidget(1, 0, label); } } }
From source file:com.ephesoft.dcma.gwt.core.client.view.RadioButtonTable.java
License:Open Source License
/** * Creates table with header and data rows. * // ww w. j av a 2 s . com * @param headerList {@link List<{@link String}>} * @param tableRowsData {@link List<{@link List<{@link String}>}>} */ public void createList(final List<String> headerList, final List<List<String>> tableRowsData) { contentTable.clear(); contentTable.removeAllRows(); boolean success = createHeaderColumns(headerList); if (success && null != tableRowsData) { int rowIndex = 0; int rowColumnWidth = HEADER_DATA_WIDTH / headerList.size(); /* Instance of map of object's id and radio button in table. */ final Map<RadioButton, String> radioVsIdMap = new HashMap<RadioButton, String>(); final Map<RadioButton, Integer> radioVsRowIdMap = new HashMap<RadioButton, Integer>(); for (List<String> rowData : tableRowsData) { if (null != rowData) { final RadioButton radioButton = new RadioButton(new Date().toString()); radioButton.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent clickEvent) { int rowIndex = 0; for (RadioButton radio : radioVsIdMap.keySet()) { radio.setValue(false); if (rowIndex % 2 == 0) { contentTable.getRowFormatter().setStyleName(rowIndex, CoreCommonConstants.ODD_CSS); } else { contentTable.getRowFormatter().setStyleName(rowIndex, CoreCommonConstants.EVEN_CSS); } rowIndex++; } radioButton.setValue(true); selectedRowId = radioVsIdMap.get(radioButton); contentTable.getRowFormatter().addStyleName(radioVsRowIdMap.get(radioButton), CoreCommonConstants.ROW_HIGHLIGHTED_CSS); } }); radioVsIdMap.put(radioButton, rowData.get(0)); radioVsRowIdMap.put(radioButton, rowIndex); contentTable.getCellFormatter().setWidth(rowIndex, 0, String.valueOf(HEADER_RADIO_WIDTH)); contentTable.setWidget(rowIndex, 0, radioButton); int columnIndex = 0; for (String columnData : rowData) { if (columnIndex > 0) { contentTable.getCellFormatter().setWidth(rowIndex, columnIndex, String.valueOf(rowColumnWidth)); contentTable.setWidget(rowIndex, columnIndex, new Label(columnData)); contentTable.getCellFormatter().setHorizontalAlignment(rowIndex, columnIndex, HasHorizontalAlignment.ALIGN_LEFT); } columnIndex++; } if (rowIndex % 2 == 0) { contentTable.getRowFormatter().setStyleName(rowIndex, CoreCommonConstants.ODD_CSS); } else { contentTable.getRowFormatter().setStyleName(rowIndex, CoreCommonConstants.EVEN_CSS); } if (rowIndex == 0) { radioButton.setValue(true); selectedRowId = radioVsIdMap.get(radioButton); contentTable.getRowFormatter().addStyleName(0, CoreCommonConstants.ROW_HIGHLIGHTED_CSS); } rowIndex++; } } } else { contentTable.getFlexCellFormatter().setColSpan(1, 0, headerList.size() + 1); contentTable.setWidget(1, 0, new Label(MSG_NO_RESULTS_FOUND)); } }
From source file:com.ephesoft.dcma.gwt.rv.client.view.FuzzySearchResultView.java
License:Open Source License
private void setBatchList(List<List<String>> data) { int rowIndex = 0; for (List<String> rowData : data) { if (rowIndex > 0) { final RadioButton radioButton = new RadioButton(new Date().toString()); radioButton.addClickHandler(new ClickHandler() { @Override/*from w w w .j a v a 2 s . c o m*/ public void onClick(ClickEvent arg0) { for (RadioButton radio : radioButtonVsRowIdMap.keySet()) { radio.setValue(false); } radioButton.setValue(true); selectedRowId = radioButtonVsRowIdMap.get(radioButton).toString(); } }); radioButtonVsRowIdMap.put(radioButton, rowIndex); if (rowIndex == 1) { radioButton.setValue(true); selectedRowId = "1"; } fuzzyTable.setWidget(rowIndex, 0, radioButton); if (rowIndex % 2 == 0) { fuzzyTable.getRowFormatter().setStyleName(rowIndex, "oddRow"); } else { fuzzyTable.getRowFormatter().setStyleName(rowIndex, "evenRow"); } int columnIndex = 1; for (String columnData : rowData) { fuzzyTable.setWidget(rowIndex, columnIndex, new Label(columnData)); columnIndex++; } } rowIndex++; } fuzzyTable.getRowFormatter().addStyleName(0, "rowHighlighted"); }
From source file:com.google.appinventor.client.editor.simple.components.MockRadioButton.java
License:Open Source License
/** * Creates a new MockRadioButton component. * * @param editor editor of source file the component belongs to *//*from www.j av a 2s. com*/ public MockRadioButton(SimpleEditor editor) { super(editor, TYPE, images.radiobutton()); // Initialize mock radioButton UI radioButtonWidget = new RadioButton("dummy-group"); radioButtonWidget.setStylePrimaryName("ode-SimpleMockComponent"); initComponent(radioButtonWidget); }
From source file:com.jwh.gwt.fasttable.sample.client.FastTableSample.java
License:Open Source License
private void buildRowCountButtons(FlexTable flexTable) { flexTable.setWidget(0, 0, new Label()); flexTable.getFlexCellFormatter().setColSpan(0, 0, 2); final String rows10 = "10 sample rows"; final String rows100 = "100 sample rows"; final String rows500 = "500 sample rows"; final String rows1000 = "1000 sample rows"; final String rowsToBuild = "rowsToBuild"; final ValueChangeHandler<Boolean> handler = new ValueChangeHandler<Boolean>() { @Override/*from w w w . ja v a 2 s.com*/ public void onValueChange(ValueChangeEvent<Boolean> event) { RadioButton selected = (RadioButton) event.getSource(); if (rows10.equals(selected.getFormValue())) { sampleRowCount = 10; } else if (rows100.equals(selected.getFormValue())) { sampleRowCount = 100; } else if (rows500.equals(selected.getFormValue())) { sampleRowCount = 500; } else { sampleRowCount = 1000; } } }; { final RadioButton radio = new RadioButton(rowsToBuild); radio.setHTML(rows10); radio.setValue(false, false); radio.setFormValue(rows10); radio.addValueChangeHandler(handler); flexTable.setWidget(1, 0, radio); flexTable.getFlexCellFormatter().setColSpan(1, 0, 2); radio.getElement().getParentElement().addClassName(BORDER_NONE); } { final RadioButton radio = new RadioButton(rowsToBuild); radio.setHTML(rows100); radio.setValue(true, false); radio.setFormValue(rows100); radio.addValueChangeHandler(handler); flexTable.setWidget(2, 0, radio); flexTable.getFlexCellFormatter().setColSpan(2, 0, 2); radio.getElement().getParentElement().addClassName(BORDER_NONE); } { final RadioButton radio = new RadioButton(rowsToBuild); radio.setHTML(rows500); radio.setValue(false, false); radio.setFormValue(rows500); radio.addValueChangeHandler(handler); flexTable.setWidget(3, 0, radio); flexTable.getFlexCellFormatter().setColSpan(3, 0, 2); radio.getElement().getParentElement().addClassName(BORDER_NONE); } { final RadioButton radio = new RadioButton(rowsToBuild); radio.setHTML(rows1000); radio.setValue(false, false); radio.setFormValue(rows1000); radio.addValueChangeHandler(handler); flexTable.setWidget(4, 0, radio); flexTable.getFlexCellFormatter().setColSpan(4, 0, 2); radio.getElement().getParentElement().addClassName(BORDER_NONE); } }