List of usage examples for com.google.gwt.user.client.ui RadioButton setValue
@Override public void setValue(Boolean value)
From source file:ar.com.cristal.creditos.client.clientes.busqueda.BusquedaClientesView.java
License:Open Source License
public void seleccionarUnicoCliente() { if (listadoAnimales.getRowCount() > 1) { RadioButton radio = (RadioButton) listadoAnimales.getWidget(1, 0); radio.setValue(true); String idSeleccionado = obtenerIdSeleccionado(); Place newPlace = new OperacionesHistorialCreditosClientePlace(idSeleccionado); listener.goTo(newPlace);//from www. j a va 2 s . c o m } }
From source file:ar.com.cristal.creditos.client.clientes.busqueda.BusquedaClientesView.java
License:Open Source License
@UiHandler("listadoAnimales") void onTableClick(ClickEvent event) { Cell cellSelected = listadoAnimales.getCellForEvent(event); int row = cellSelected.getRowIndex(); if (row > 0) { RadioButton radio = (RadioButton) listadoAnimales.getWidget(row, 0); radio.setValue(true); }//from w w w.j a va2 s . c om }
From source file:at.ait.dme.yuma.client.image.shape.ShapeControlPanel.java
License:EUPL
/** * creates the radio buttons to choose the shape *//* w w w . j a v a 2 s .co m*/ private void createShapeRadioButtons() { Label shapeLabel = new Label(shapeConstants.shape()); shapeLabel.setStyleName("imageFragment-controlpanel-label"); RadioButton rectangle = new RadioButton(SHAPE_RADIO_GROUP_NAME, shapeConstants.rectangle()); rectangle.setStyleName("imageFragment-controlpanel-radio-button"); rectangle.setValue(shape instanceof Rectangle); rectangle.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { shape = new Rectangle(shape); redrawShape(); } }); RadioButton ellipse = new RadioButton(SHAPE_RADIO_GROUP_NAME, shapeConstants.ellipse()); ellipse.setStyleName("imageFragment-controlpanel-radio-button"); ellipse.setValue(shape instanceof Ellipse); ellipse.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { shape = new Ellipse(shape); redrawShape(); } }); RadioButton cross = new RadioButton(SHAPE_RADIO_GROUP_NAME, shapeConstants.cross()); cross.setStyleName("imageFragment-controlpanel-radio-button"); cross.setValue(shape instanceof Cross); cross.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { shape = new Cross(shape); redrawShape(); } }); RadioButton polygon = new RadioButton(SHAPE_RADIO_GROUP_NAME, shapeConstants.polygon()); polygon.setStyleName("imageFragment-controlpanel-radio-button"); polygon.setValue(shape instanceof Polygon); polygon.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { shape = new Polygon(shape); redrawShape(); shapePanel.startDrawPolygon((Polygon) shape); } }); RadioButton freehand = new RadioButton(SHAPE_RADIO_GROUP_NAME, shapeConstants.freehand()); freehand.setStyleName("imageFragment-controlpanel-radio-button"); freehand.setValue(shape instanceof Polyline); freehand.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { shape = new Polyline(shape); redrawShape(); shapePanel.startDrawPolyline((Polyline) shape); } }); contentTable.setWidget(0, 0, shapeLabel); contentTable.setWidget(0, 1, rectangle); contentTable.setWidget(0, 2, ellipse); contentTable.setWidget(0, 3, cross); contentTable.setWidget(0, 4, polygon); contentTable.setWidget(0, 5, freehand); }
From source file:at.ait.dme.yuma.client.image.shape.ShapeControlPanel.java
License:EUPL
/** * creates radio buttons to change the stroke width of the shape *///from w w w . j a va 2 s . c om private void createStrokeWidthRadioButtons() { Label strokeLabel = new Label(shapeConstants.strokeWidth()); strokeLabel.setStyleName("imageFragment-controlpanel-label"); RadioButton thin = new RadioButton(STROKEWIDTH_RADIO_GROUP_NAME, shapeConstants.thin()); thin.setStyleName("imageFragment-controlpanel-radio-button"); thin.setValue(shape.getStrokeWidth() == 1); thin.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { shape.setStrokeWidth(1); redrawShape(); } }); RadioButton medium = new RadioButton(STROKEWIDTH_RADIO_GROUP_NAME, shapeConstants.medium()); medium.setStyleName("imageFragment-controlpanel-radio-button"); medium.setValue(shape.getStrokeWidth() == 2); medium.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { shape.setStrokeWidth(2); redrawShape(); } }); RadioButton thick = new RadioButton(STROKEWIDTH_RADIO_GROUP_NAME, shapeConstants.thick()); thick.setStyleName("imageFragment-controlpanel-radio-button"); thick.setValue(shape.getStrokeWidth() == 3); thick.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { shape.setStrokeWidth(3); redrawShape(); } }); contentTable.setWidget(1, 0, strokeLabel); contentTable.setWidget(1, 1, thin); contentTable.setWidget(1, 2, medium); contentTable.setWidget(1, 3, thick); }
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); radio.addClickHandler(new ClickHandler() { @Override/*from w w w. ja v a 2 s .c o m*/ 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:com.achow101.bctalkaccountpricer.client.Bitcointalk_Account_Pricer.java
License:Open Source License
/** * This is the entry point method.//from www.j ava2s. co m */ public void onModuleLoad() { // Add Gui stuff final Button sendButton = new Button("Estimate Price"); final TextBox nameField = new TextBox(); nameField.setText("User ID/Token"); final Label errorLabel = new Label(); final Label uidLabel = new Label(); final Label usernameLabel = new Label(); final Label postsLabel = new Label(); final Label activityLabel = new Label(); final Label potActivityLabel = new Label(); final Label postQualityLabel = new Label(); final Label trustLabel = new Label(); final Label priceLabel = new Label(); final Label loadingLabel = new Label(); final Label tokenLabel = new Label(); final InlineHTML estimateShareLabel = new InlineHTML(); final InlineHTML reportTimeStamp = new InlineHTML(); final RadioButton radioNormal = new RadioButton("merch", "Normal"); final RadioButton radioMerchant = new RadioButton("merch", "Merchant"); // We can add style names to widgets sendButton.addStyleName("sendButton"); radioNormal.setValue(true); radioMerchant.setValue(false); // Add the nameField and sendButton to the RootPanel // Use RootPanel.get() to get the entire body element RootPanel.get("nameFieldContainer").add(nameField); RootPanel.get("sendButtonContainer").add(sendButton); RootPanel.get("errorLabelContainer").add(errorLabel); RootPanel.get("uidLabelContainer").add(uidLabel); RootPanel.get("usernameLabelContainer").add(usernameLabel); RootPanel.get("postsLabelContainer").add(postsLabel); RootPanel.get("activityLabelContainer").add(activityLabel); RootPanel.get("potActivityLabelContainer").add(potActivityLabel); RootPanel.get("postQualityLabelContainer").add(postQualityLabel); RootPanel.get("trustLabelContainer").add(trustLabel); RootPanel.get("priceLabelContainer").add(priceLabel); RootPanel.get("loadingLabelContainer").add(loadingLabel); RootPanel.get("tokenLabelContainer").add(tokenLabel); RootPanel.get("tokenShareLabelContainer").add(estimateShareLabel); RootPanel.get("radioNormalContainer").add(radioNormal); RootPanel.get("radioMerchantContainer").add(radioMerchant); RootPanel.get("reportTimeStamp").add(reportTimeStamp); // Create activity breakdown panel final VerticalPanel actPanel = new VerticalPanel(); final FlexTable actTable = new FlexTable(); actPanel.add(actTable); RootPanel.get("activityBreakdown").add(actPanel); // Create posts breakdown panel final VerticalPanel postsPanel = new VerticalPanel(); final FlexTable postsTable = new FlexTable(); postsPanel.add(postsTable); RootPanel.get("postsBreakdown").add(postsPanel); // Create addresses breakdown panel final VerticalPanel addrPanel = new VerticalPanel(); final FlexTable addrTable = new FlexTable(); postsPanel.add(addrTable); RootPanel.get("addrBreakdown").add(addrTable); // Focus the cursor on the name field when the app loads nameField.setFocus(true); nameField.selectAll(); // Create a handler for the sendButton and nameField class MyHandler implements ClickHandler, KeyUpHandler { /** * Fired when the user clicks on the sendButton. */ public void onClick(ClickEvent event) { // Add request to queue addToQueue(); } /** * Fired when the user types in the nameField. */ public void onKeyUp(KeyUpEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { addToQueue(); } } // Adds the request to server queue private void addToQueue() { // Clear previous output uidLabel.setText(""); usernameLabel.setText(""); postsLabel.setText(""); activityLabel.setText(""); potActivityLabel.setText(""); postQualityLabel.setText(""); trustLabel.setText(""); priceLabel.setText(""); sendButton.setEnabled(false); errorLabel.setText(""); loadingLabel.setText(""); tokenLabel.setText(""); estimateShareLabel.setText(""); reportTimeStamp.setText(""); actTable.removeAllRows(); postsTable.removeAllRows(); addrTable.removeAllRows(); // Create and add request request = new QueueRequest(); request.setMerchant(radioMerchant.getValue()); if (nameField.getText().matches("^[0-9]+$")) request.setUid(Integer.parseInt(escapeHtml(nameField.getText()))); else { request.setToken(escapeHtml(nameField.getText())); request.setOldReq(); } final String urlPath = com.google.gwt.user.client.Window.Location.getPath(); final String host = com.google.gwt.user.client.Window.Location.getHost(); final String protocol = com.google.gwt.user.client.Window.Location.getProtocol(); final String url = protocol + "//" + host + urlPath + "?token="; // Request check loop Timer requestTimer = new Timer() { public void run() { // send request to server pricingService.queueServer(request, new AsyncCallback<QueueRequest>() { @Override public void onFailure(Throwable caught) { errorLabel.setText("Request Queuing failed. Please try again."); sendButton.setEnabled(true); pricingService.removeRequest(request, null); cancel(); } @Override public void onSuccess(QueueRequest result) { if (result.getQueuePos() == -3) { loadingLabel.setText( "Please wait for your previous request to finish and try again"); sendButton.setEnabled(true); cancel(); } else if (result.getQueuePos() == -2) { loadingLabel.setText("Please wait 2 minutes before requesting again."); sendButton.setEnabled(true); cancel(); } else if (result.getQueuePos() == -4) { loadingLabel.setText("Invalid token"); sendButton.setEnabled(true); cancel(); } else { tokenLabel.setText("Your token is " + result.getToken()); estimateShareLabel.setHTML("Share this estimate: <a href=\"" + url + result.getToken() + "\">" + url + result.getToken() + "</a>"); if (!result.isProcessing() && !result.isDone()) { loadingLabel.setText("Please wait. You are number " + result.getQueuePos() + " in the queue."); } if (result.isProcessing()) { loadingLabel.setText("Request is processing. Please wait."); } if (result.isDone()) { // Clear other messages errorLabel.setText(""); loadingLabel.setText(""); // Output results uidLabel.setText(result.getResult()[0]); usernameLabel.setText(result.getResult()[1]); postsLabel.setText(result.getResult()[2]); activityLabel.setText(result.getResult()[3]); potActivityLabel.setText(result.getResult()[4]); postQualityLabel.setText(result.getResult()[5]); trustLabel.setText(result.getResult()[6]); priceLabel.setText(result.getResult()[7]); int indexOfLastAct = 0; int startAddrIndex = 0; for (int i = 8; i < result.getResult().length; i++) { if (result.getResult()[i].equals("<b>Post Sections Breakdown</b>")) { indexOfLastAct = i; break; } actTable.setHTML(i - 8, 0, result.getResult()[i]); } for (int i = indexOfLastAct; i < result.getResult().length; i++) { if (result.getResult()[i] .contains("<b>Addresses posted in non-quoted text</b>")) { startAddrIndex = i; break; } postsTable.setHTML(i - indexOfLastAct, 0, result.getResult()[i]); } if (!result.isMerchant()) { for (int i = startAddrIndex; i < result.getResult().length; i++) { addrTable.setHTML(i - startAddrIndex, 0, result.getResult()[i]); } } // Set the right radio radioMerchant.setValue(result.isMerchant()); radioNormal.setValue(!result.isMerchant()); // Report the time stamp DateTimeFormat fmt = DateTimeFormat.getFormat("MMMM dd, yyyy, hh:mm:ss a"); Date completedDate = new Date(1000L * result.getCompletedTime()); Date expireDate = new Date( 1000L * (result.getCompletedTime() + result.getExpirationTime())); reportTimeStamp .setHTML("<i>Report generated at " + fmt.format(completedDate) + " and expires at " + fmt.format(expireDate) + "</i>"); // Kill the timer after everything is done cancel(); } request = result; request.setPoll(true); sendButton.setEnabled(true); } } }); } }; requestTimer.scheduleRepeating(2000); } } // Add a handler to send the name to the server MyHandler handler = new MyHandler(); sendButton.addClickHandler(handler); nameField.addKeyUpHandler(handler); // Check the URL for URL parameters String urlTokenParam = com.google.gwt.user.client.Window.Location.getParameter("token"); if (!urlTokenParam.isEmpty()) { nameField.setText(urlTokenParam); handler.addToQueue(); } }
From source file:com.allen_sauer.gwt.dnd.demo.client.BidiBehaviorPanel.java
License:Apache License
public BidiBehaviorPanel(final DragController dragController) { super("Bidi", "Force rtl/ltr text direction"); final RadioButton ltrButton = newButton("Left to right", "direction: ltr"); final RadioButton rtlButton = newButton("Right to left", "direction: rtl"); add(ltrButton);/*from ww w . j a v a2 s . co m*/ add(rtlButton); if ("rtl".equals(DOMUtil.getEffectiveStyle(Document.get().getBody(), "direction"))) { rtlButton.setValue(true); } else { ltrButton.setValue(true); } ClickHandler handler = new ClickHandler() { @Override public void onClick(ClickEvent event) { BodyElement body = Document.get().getBody(); if (rtlButton.getValue()) { body.addClassName("rtl"); body.removeClassName("ltr"); } else { body.addClassName("ltr"); body.removeClassName("rtl"); } } }; ltrButton.addClickHandler(handler); rtlButton.addClickHandler(handler); }
From source file:com.allen_sauer.gwt.dnd.demo.client.ConstrainedToBoundaryBehaviorPanel.java
License:Apache License
public ConstrainedToBoundaryBehaviorPanel(final DragController dragController) { super("Drag Operations", "getBehaviorConstrainedToBoundaryPanel() / setBehaviorConstrainedToBoundaryPanel(boolean)"); final RadioButton constrainedButton = newButton("Constrained by Boundary", "DragController#setBehaviorConstrainedToBoundaryPanel(true)"); final RadioButton unconstrainedButton = newButton("Unconstrained", "DragController#setBehaviorConstrainedToBoundaryPanel(false)"); add(constrainedButton);/* www. java2 s. co m*/ add(unconstrainedButton); if (dragController.getBehaviorConstrainedToBoundaryPanel()) { constrainedButton.setValue(true); } else { unconstrainedButton.setValue(true); } ClickHandler handler = new ClickHandler() { @Override public void onClick(ClickEvent event) { dragController.setBehaviorConstrainedToBoundaryPanel(constrainedButton.getValue()); } }; constrainedButton.addClickHandler(handler); unconstrainedButton.addClickHandler(handler); }
From source file:com.allen_sauer.gwt.dnd.demo.client.DragProxyBehaviorPanel.java
License:Apache License
public DragProxyBehaviorPanel(final PickupDragController dragController) { super("Drag Proxy Behavior", "getBehaviorDragProxy() / setBehaviorDragProxy(boolean)"); final RadioButton classicButton = newButton("Widget is dragged", "PickupDragController#setBehaviorDragProxy(false)"); final RadioButton proxyButton = newButton("Use drag proxies", "PickupDragController#setBehaviorDragProxy(true)"); add(classicButton);/*from ww w. ja va2 s . c o m*/ add(proxyButton); if (dragController.getBehaviorDragProxy()) { proxyButton.setValue(true); } else { classicButton.setValue(true); } ClickHandler handler = new ClickHandler() { @Override public void onClick(ClickEvent event) { dragController.setBehaviorDragProxy(proxyButton.getValue()); } }; classicButton.addClickHandler(handler); proxyButton.addClickHandler(handler); }
From source file:com.allen_sauer.gwt.dnd.demo.client.MultipleSelectionBehaviorPanel.java
License:Apache License
public MultipleSelectionBehaviorPanel(final PickupDragController dragController) { super("Multiple Selections", "getBehaviorMultipleSelection() / setBehaviorMultipleSelection(boolean)"); final RadioButton constrainedButton = newButton("Allow via <code>CTRL</code>/<code>META</code>-click", "DragController#setBehaviorMultipleSelection(true)"); final RadioButton unconstrainedButton = newButton("Single widget drag only", "DragController#setBehaviorMultipleSelection(false)"); add(constrainedButton);/*from w ww . j a va 2 s . co m*/ add(unconstrainedButton); if (dragController.getBehaviorMultipleSelection()) { constrainedButton.setValue(true); } else { unconstrainedButton.setValue(true); } ClickHandler listener = new ClickHandler() { @Override public void onClick(ClickEvent event) { dragController.setBehaviorMultipleSelection(constrainedButton.getValue()); } }; constrainedButton.addClickHandler(listener); unconstrainedButton.addClickHandler(listener); }