List of usage examples for com.google.gwt.user.client.ui Label setText
public void setText(String text)
From source file:gov.nist.spectrumbrowser.admin.SweptFrequencySensorBands.java
License:Open Source License
public void draw() { verticalPanel.clear();/*from w w w. j av a 2s .c om*/ HTML html = new HTML("<H2>Bands for sensor : " + sensor.getSensorId() + "</H2>"); verticalPanel.add(html); JSONObject sensorThresholds = sensor.getThresholds(); Grid grid = new Grid(sensorThresholds.keySet().size() + 1, 8); grid.setBorderWidth(2); grid.setCellPadding(2); grid.setCellSpacing(2); grid.setText(0, 0, "System To Detect"); grid.setText(0, 1, "Min Freq (Hz)"); grid.setText(0, 2, "Max Freq (Hz)"); grid.setText(0, 3, "Channel Count"); grid.setText(0, 4, "Occupancy Threshold (dBm/Hz)"); grid.setText(0, 5, "Occupancy Threshold (dBm)"); grid.setText(0, 6, "Enabled?"); grid.setText(0, 7, "Delete Band"); grid.setBorderWidth(2); grid.setCellPadding(2); grid.setCellSpacing(2); CellFormatter formatter = grid.getCellFormatter(); for (int i = 0; i < grid.getRowCount(); i++) { for (int j = 0; j < grid.getColumnCount(); j++) { formatter.setHorizontalAlignment(i, j, HasHorizontalAlignment.ALIGN_CENTER); formatter.setVerticalAlignment(i, j, HasVerticalAlignment.ALIGN_MIDDLE); } } for (int i = 0; i < grid.getColumnCount(); i++) { grid.getCellFormatter().setStyleName(0, i, "textLabelStyle"); } int row = 1; for (String key : sensorThresholds.keySet()) { final SweptFrequencyBand threshold = new SweptFrequencyBand(sensorThresholds.get(key).isObject()); grid.setText(row, 0, threshold.getSystemToDetect()); grid.setText(row, 1, Long.toString(threshold.getMinFreqHz())); grid.setText(row, 2, Long.toString(threshold.getMaxFreqHz())); final TextBox channelCountTextBox = new TextBox(); channelCountTextBox.setText(Long.toString(threshold.getChannelCount())); channelCountTextBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { Long oldValue = Long.parseLong(channelCountTextBox.getValue()); try { long newValue = Long.parseLong(event.getValue()); threshold.setChannelCount((long) newValue); } catch (Exception ex) { Window.alert(ex.getMessage()); channelCountTextBox.setValue(Double.toString(oldValue)); } } }); grid.setWidget(row, 3, channelCountTextBox); final Label thresholdLabel = new Label(); final TextBox thresholdTextBox = new TextBox(); thresholdTextBox.setText(Double.toString(threshold.getThresholdDbmPerHz())); thresholdTextBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { Double oldThreshold = Double.parseDouble(thresholdTextBox.getValue()); try { double newThreshold = Double.parseDouble(event.getValue()); threshold.setThresholdDbmPerHz(newThreshold); thresholdLabel.setText(Float.toString(threshold.getThresholdDbm())); } catch (Exception ex) { Window.alert(ex.getMessage()); thresholdTextBox.setValue(Double.toString(oldThreshold)); } } }); grid.setWidget(row, 4, thresholdTextBox); thresholdLabel.setText(Float.toString(threshold.getThresholdDbm())); grid.setWidget(row, 5, thresholdLabel); CheckBox activeCheckBox = new CheckBox(); grid.setWidget(row, 6, activeCheckBox); activeCheckBox.setValue(threshold.isActive()); activeCheckBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { if (event.getValue()) { for (String key : sensor.getThresholds().keySet()) { SweptFrequencyBand th = new SweptFrequencyBand(sensor.getThreshold(key)); th.setActive(false); } } threshold.setActive(event.getValue()); draw(); } }); Button deleteButton = new Button("Delete Band"); deleteButton.addClickHandler(new DeleteThresholdClickHandler(threshold)); grid.setWidget(row, 7, deleteButton); row++; } verticalPanel.add(grid); HorizontalPanel horizontalPanel = new HorizontalPanel(); Button addButton = new Button("Add Band"); addButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { new AddSweptFrequencySensorBand(admin, SweptFrequencySensorBands.this, sensorConfig, sensor, verticalPanel).draw(); } }); horizontalPanel.add(addButton); Button recomputeButton = new Button("Recompute Occupancies"); recomputeButton.setTitle("Recomputes per message summary occupancies."); recomputeButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { boolean yes = Window.confirm( "Ensure no users are using the system. Update sensor before proceeding. This can take a long time. Proceed?"); if (yes) { final HTML html = new HTML( "<h3>Recomputing thresholds - this can take a while. Please wait. </h3>"); verticalPanel.add(html); Admin.getAdminService().recomputeOccupancies(sensor.getSensorId(), new SpectrumBrowserCallback<String>() { @Override public void onSuccess(String result) { verticalPanel.remove(html); } @Override public void onFailure(Throwable throwable) { Window.alert("Error communicating with server"); admin.logoff(); } }); } } }); horizontalPanel.add(recomputeButton); Button doneButton = new Button("Done"); doneButton.setTitle("Return to sensors screen"); doneButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { sensorConfig.redraw(); } }); horizontalPanel.add(doneButton); Button updateButton = new Button("Update"); updateButton.setTitle("Update sensor on server"); updateButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { Admin.getAdminService().updateSensor(sensor.toString(), sensorConfig); } }); horizontalPanel.add(updateButton); Button logoffButton = new Button("Log Off"); logoffButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { admin.logoff(); } }); horizontalPanel.add(logoffButton); verticalPanel.add(horizontalPanel); }
From source file:gov.nist.spectrumbrowser.client.SensorInfoDisplay.java
License:Open Source License
/** * Show the sensor summary information in the side of the map. * //from ww w . jav a2 s . co m */ void buildSummary() { logger.finer("SensorInfoDisplay: buildSummary " + getId()); try { info = sensorInfo.getSensorDescriptionNoBands(); sensorDescriptionPanel.add(info); for (final String bandName : sensorInfo.getBandNames()) { final BandInfo bandInfo = sensorInfo.getBandInfo(bandName); if (bandInfo != null) { VerticalPanel bandDescriptionPanel = new VerticalPanel(); HTML bandDescription = sensorInfo.getBandDescription(bandName); bandDescriptionPanel.add(bandDescription); if (sensorInfo.getMeasurementType().equals(Defines.SWEPT_FREQUENCY)) { HorizontalPanel showAdvancedPanel = new HorizontalPanel(); showAdvancedPanel.add(new Label("Advanced ")); CheckBox advancedCheckBox = new CheckBox(); advancedCheckBox.setValue(false); showAdvancedPanel.add(advancedCheckBox); bandDescriptionPanel.add(showAdvancedPanel); final VerticalPanel advancedPanel = new VerticalPanel(); advancedPanel.add(new Label("Specify Sub-band :")); Grid grid = new Grid(2, 2); grid.setText(0, 0, "Min Freq (MHz):"); minFreqBox = new TextBox(); minFreqBox.setText(Double.toString(bandInfo.getSelectedMinFreq() / 1E6)); minFreqBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { try { double newFreq = Double.parseDouble(event.getValue()); if (!bandInfo.setSelectedMinFreq((long) (newFreq * 1E6))) { Window.alert("Illegal value entered"); minFreqBox.setText(Double.toString(bandInfo.getSelectedMinFreq() / 1E6)); } } catch (NumberFormatException ex) { Window.alert("Illegal Entry"); minFreqBox.setText(Double.toString(bandInfo.getMinFreq() / 1E6)); } } }); minFreqBox.setTitle("Enter value >= " + bandInfo.getMinFreq() / 1E6); grid.setWidget(0, 1, minFreqBox); grid.setText(1, 0, "Max Freq (MHz):"); maxFreqBox = new TextBox(); maxFreqBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { try { double newFreq = Double.parseDouble(event.getValue()); if (!bandInfo.setSelectedMaxFreq((long) (newFreq * 1E6))) { Window.alert("Illegal value entered"); maxFreqBox.setText(Double.toString(bandInfo.getSelectedMaxFreq() / 1E6)); } } catch (NumberFormatException ex) { Window.alert("Illegal Entry"); maxFreqBox.setText(Double.toString(bandInfo.getSelectedMaxFreq() / 1E6)); } } }); maxFreqBox.setText(Double.toString(bandInfo.getSelectedMaxFreq() / 1E6)); maxFreqBox.setTitle("Enter value <= " + bandInfo.getMaxFreq() / 1E6); grid.setWidget(1, 1, maxFreqBox); advancedPanel.add(grid); advancedPanel.add(new Label("Changing to non-default values increases compute time")); Grid updateGrid = new Grid(1, 2); Button changeButton = new Button("Change"); updateGrid.setWidget(0, 0, changeButton); final Label label = new Label(); updateGrid.setWidget(0, 1, label); changeButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { double minFreq = Double.parseDouble(minFreqBox.getText()); double maxFreq = Double.parseDouble(maxFreqBox.getText()); if (!bandInfo.setSelectedMaxFreq((long) (maxFreq * 1E6)) || !bandInfo.setSelectedMinFreq((long) (minFreq * 1E6))) { Window.alert("Illegal value entered"); minFreqBox.setText(Double.toString(bandInfo.getMinFreq() / 1E6)); maxFreqBox.setText(Double.toString(bandInfo.getSelectedMaxFreq() / 1E6)); } else { updateAcquistionCount(); label.setText("Changes Updated"); Timer timer = new Timer() { @Override public void run() { label.setText(null); } }; timer.schedule(2000); } } }); advancedPanel.add(updateGrid); bandDescriptionPanel.add(advancedPanel); advancedPanel.setVisible(false); advancedCheckBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { if (event.getValue()) { advancedPanel.setVisible(true); } else { advancedPanel.setVisible(false); } } }); } final Label bandSelectionButton = new Label(bandInfo.getFreqRange().toString()); bandSelectionButton.getElement().getStyle().setCursor(Cursor.POINTER); if (bandInfo.isActive()) { bandSelectionButton.setStyleName("activeBandSelectionButton"); bandSelectionButton.setTitle("Enabled for data collection"); } else { bandSelectionButton.setTitle("Disabled for data collection"); bandSelectionButton.setStyleName("bandSelectionButton"); } sensorDescriptionPanel.add(bandSelectionButton); sensorDescriptionPanel.add(bandDescriptionPanel); bandDescriptionPanel.setVisible(false); selectionButtons.add(bandSelectionButton); bandInfo.setSelectionButton(bandSelectionButton); bandDescriptionPanels.add(bandDescriptionPanel); bandSelectionButton.addClickHandler( new SelectBandClickHandler(bandDescriptionPanel, bandSelectionButton, bandInfo)); } } } catch (Exception ex) { logger.log(Level.SEVERE, "Error in updating data summary ", ex); ex.printStackTrace(); } finally { } }
From source file:gov.nist.spectrumbrowser.client.SpectrumBrowserShowDatasets.java
License:Open Source License
public void draw() { try {//from w w w .j av a 2s .c om spectrumBrowser.showWaitImage(); Window.setTitle("MSOD:Home"); SpectrumBrowser.clearSensorInformation(); sensorMarkers.clear(); SensorGroupMarker.clear(); verticalPanel.clear(); navigationBar = new MenuBar(); navigationBar.clearItems(); verticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); verticalPanel.add(navigationBar); HorizontalPanel mapAndSensorInfoPanel = new HorizontalPanel(); mapAndSensorInfoPanel.setStyleName("mapAndSensorInfoPanel"); HTML html = new HTML("<h2>" + END_LABEL + "</h2> ", true); verticalPanel.add(html); String help = "Click on a sensor marker to select it. " + "Then select start date and and duration of interest."; helpLabel = new Label(); helpLabel.setText(help); verticalPanel.add(helpLabel); ScrollPanel scrollPanel = new ScrollPanel(); scrollPanel.setHeight(SpectrumBrowser.MAP_WIDTH + "px"); scrollPanel.setStyleName("sensorInformationScrollPanel"); sensorInfoPanel = new VerticalPanel(); sensorInfoPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); scrollPanel.add(sensorInfoPanel); sensorInfoPanel.setStyleName("sensorInfoPanel"); mapAndSensorInfoPanel.add(scrollPanel); selectionGrid = new Grid(1, 10); selectionGrid.setStyleName("selectionGrid"); selectionGrid.setVisible(false); for (int i = 0; i < selectionGrid.getRowCount(); i++) { for (int j = 0; j < selectionGrid.getColumnCount(); j++) { selectionGrid.getCellFormatter().setHorizontalAlignment(i, j, HasHorizontalAlignment.ALIGN_CENTER); selectionGrid.getCellFormatter().setVerticalAlignment(i, j, HasVerticalAlignment.ALIGN_MIDDLE); } } verticalPanel.add(selectionGrid); sensorInfoPanel.clear(); //sensorInfoPanel.setTitle("Click on marker to select sensors."); Label selectedMarkersLabel = new Label(); selectedMarkersLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); selectedMarkersLabel.setText("Sensor Information Display"); selectedMarkersLabel.getElement().getStyle().setCursor(Cursor.TEXT); selectedMarkersLabel.setStyleName("selectedMarkersLabel"); sensorInfoPanel.add(selectedMarkersLabel); if (map == null) { MapOptions mapOptions = MapOptions.newInstance(true); mapOptions.setMaxZoom(15); mapOptions.setMinZoom(3); mapOptions.setStreetViewControl(false); map = new MapWidget(mapOptions); //map.setTitle("Click on a marker to display information about a sensor."); map.setSize(SpectrumBrowser.MAP_WIDTH + "px", SpectrumBrowser.MAP_HEIGHT + "px"); } else if (map.getParent() != null) { map.removeFromParent(); } mapAndSensorInfoPanel.add(map); verticalPanel.add(mapAndSensorInfoPanel); logger.finer("getLocationInfo"); spectrumBrowser.getSpectrumBrowserService().getLocationInfo(SpectrumBrowser.getSessionToken(), new SpectrumBrowserCallback<String>() { @Override public void onFailure(Throwable caught) { logger.log(Level.SEVERE, "Error in processing request", caught); verticalPanel.clear(); if (spectrumBrowser.isUserLoggedIn()) { Window.alert("The system is down for maintenance. Please try again later.\n" + caught.getMessage()); spectrumBrowser.logoff(); } else { HTML error = new HTML( "<h1>The System is down for maintenance. Please try later.</h1>"); verticalPanel.add(error); HTML errorMsg = new HTML("<h2>" + caught.getMessage() + "</h2>"); verticalPanel.add(errorMsg); } } @Override public void onSuccess(String jsonString) { try { logger.finer(jsonString); JSONObject jsonObj = (JSONObject) JSONParser.parseLenient(jsonString); String baseUrl = SpectrumBrowser.getBaseUrlAuthority(); addSensor(jsonObj, baseUrl); logger.finer("Added returned sensors. Dealing with peers"); // Now deal with the peers. final JSONObject peers = jsonObj.get("peers").isObject(); // By definition, peers do not need login but we need a session // Key to talk to the peer so go get one. for (String url : peers.keySet()) { logger.finer("Showing sensors for Peer " + url); final String peerUrl = url; spectrumBrowser.getSpectrumBrowserService().isAuthenticationRequired(url, new SpectrumBrowserCallback<String>() { @Override public void onSuccess(String result) { JSONObject jobj = JSONParser.parseLenient(result).isObject(); boolean authRequired = jobj.get("AuthenticationRequired") .isBoolean().booleanValue(); if (!authRequired) { String sessionToken = jobj.get("SessionToken").isString() .stringValue(); SpectrumBrowser.setSessionToken(peerUrl, sessionToken); JSONObject peerObj = peers.get(peerUrl).isObject(); addSensor(peerObj, peerUrl); } } @Override public void onFailure(Throwable throwable) { logger.log(Level.SEVERE, "Could not contact peer at " + peerUrl, throwable); } }); } final Timer timer = new Timer() { @Override public void run() { if (getMap().isAttached()) { spectrumBrowser.hideWaitImage(); showMarkers(); cancel(); } } }; timer.scheduleRepeating(500); populateMenuItems(); map.addZoomChangeHandler(new ZoomChangeMapHandler() { @Override public void onEvent(ZoomChangeMapEvent event) { SensorGroupMarker.showMarkers(); } }); } catch (Exception ex) { logger.log(Level.SEVERE, "Error ", ex); spectrumBrowser.displayError("Error parsing json response"); } } } ); } catch (Exception ex) { logger.log(Level.SEVERE, "Error in displaying data sets", ex); } }
From source file:gwt.g2d.tetris.client.Tetris.java
License:Apache License
/** * Creates a header label./*from ww w. j a va 2s . co m*/ * * @param text * @return the label wrapped in a h2 tag. */ private Label createHeaderLabel(String text) { // Label label = Label.wrap(DOM.createElement("h2")); Label label = new Label(); label.setText(text); return label; }
From source file:gwtquery.plugins.draggable.client.GWTIntegrationSample.java
License:Apache License
/** * Create a Date picker. The code comes from the GWT show case : * http://gwt.google.com/samples/Showcase/Showcase.html#!CwDatePicker@ * * @return//ww w . j ava 2 s . c o m */ private VerticalPanel createDatePanel() { // Create a basic date picker DatePicker datePicker = new DatePicker(); final Label text = new Label(); // Set the value in the text box when the user selects a date datePicker.addValueChangeHandler(new ValueChangeHandler<Date>() { public void onValueChange(ValueChangeEvent<Date> event) { Date date = event.getValue(); String dateString = DateTimeFormat.getMediumDateFormat().format(date); text.setText(dateString); } }); // Set the default value datePicker.setValue(new Date(), true); // Combine the widgets into a panel and return them VerticalPanel vPanel = new VerticalPanel(); vPanel.add(new HTML("Permanent DatePicker:")); vPanel.add(text); vPanel.add(datePicker); return vPanel; }
From source file:gwtquery.plugins.droppable.client.gwtsimplesample.GwtSimpleSample.java
License:Apache License
/** * Simply create a {@link Label} and make it droppable * //from www . ja va 2 s. co m * @return */ private Widget createTrashBin() { final Label trashBinLabel = new Label("Feed me !"); trashBinLabel.addStyleName(Resources.INSTANCE.css().trashBin()); // make the label droppable DroppableWidget<Label> trashBin = new DroppableWidget<Label>(trashBinLabel); // specify wich class has to be used when a draggable widget is over the // droppable trashBin.setDroppableHoverClass(Resources.INSTANCE.css().droppableHover()); // add a drop handler trashBin.addDropHandler(new DropEventHandler() { int counter = 0; public void onDrop(DropEvent event) { Widget droppedImage = event.getDraggableWidget(); droppedImage.removeFromParent(); counter++; trashBinLabel.setText("I ate " + counter + " image" + (counter > 1 ? "s" : "")); } }); // return the droppable widget return trashBin; }
From source file:gwtquery.samples.client.GwtQuerySampleModule.java
License:Apache License
public void onModuleLoad() { // Use compiled selectors Sample s = GWT.create(Sample.class); // Just a simple usage of dom manipulation, events, and lazy usage s.allNotes().text("Hello Google I/O").css(CSS.CURSOR.with(Cursor.POINTER)) .toggle(lazy().css(CSS.COLOR.with(RGBColor.RED)).done(), lazy().css(CSS.COLOR.with(null)).done()); // Cascade effects $("<div id='id' style='font-size: 150%;'>Cascade Efects</div>").appendTo(document).hide().fadeIn(5000) .fadeOut(3000);/*from w ww . ja v a 2 s. co m*/ // Widgets $(".btn").as(Widgets).button(new WidgetInitializer<Button>() { public void initialize(Button button, Element e) { final String tag = e.getTagName(); button.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { Window.alert("You click on a GWT Button created from a " + tag); } }); } }); $(".inputText").as(Widgets).textBox(); $(".inputPsw").as(Widgets).passwordBox(); $(".textArea").as(Widgets).textArea(); $(".label").as(Widgets).label(new WidgetInitializer<Label>() { public void initialize(Label label, Element e) { label.setText("I'm a gwt label, created from a " + e.getTagName()); } }); }
From source file:hu.belicza.andras.sc2gearsdb.apiuser.client.ui.ApiKeyPage.java
@Override public void buildGUI() { SERVICE_ASYNC.getApiKey(getSharedApiAccount(), new AsyncCallbackAdapter<String>(infoPanel) { @Override/*from w w w.ja v a 2 s.c om*/ public void customOnSuccess(final RpcResult<String> rpcResult) { final String apiKey = rpcResult.getValue(); if (apiKey == null) return; add(ClientUtils.createVerticalEmptyWidget(5)); add(new Label("Your current API key: ")); add(ClientUtils.createVerticalEmptyWidget(15)); final Label apiKeylabel = new Label(apiKey); apiKeylabel.addStyleName("authKey"); add(apiKeylabel); add(ClientUtils.createVerticalEmptyWidget(15)); final Button generateNewKeyButton = new Button("Generate new API key"); ClientUtils.setWidgetIcon(generateNewKeyButton, "fugue/license-key.png", null, "#fa7"); generateNewKeyButton.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { generateNewKeyButton.setEnabled(false); SERVICE_ASYNC.generateNewApiKey(getSharedApiAccount(), new AsyncCallbackAdapter<String>(infoPanel) { @Override public void customOnSuccess(final RpcResult<String> rpcResult) { final String newApiKey = rpcResult.getValue(); if (newApiKey != null) { infoPanel.setInfoMessage("New API key successfully created."); apiKeylabel.setText(newApiKey); } } @Override public void customOnEnd() { generateNewKeyButton.setEnabled(true); }; }); } }); add(generateNewKeyButton); add(ClientUtils.createVerticalEmptyWidget(25)); final Label noteLabel = new Label( "Note: If you generate a new API key, you have to use the new API key in all your requests, else your requests will be rejected (with HTTP status code 403 - FORBIDDEN). By generating a new API key the old key becomes invalid."); noteLabel.setWidth("600px"); add(noteLabel); } }); }
From source file:hu.belicza.andras.sc2gearsdb.user.client.ui.AuthorizationKeyPage.java
@Override public void buildGUI() { if (!checkPagePermission(Permission.VIEW_AUTHORIZATION_KEY)) return;/*from w w w . j a va 2s .c om*/ SERVICE_ASYNC.getAuthorizationKey(getSharedAccount(), new AsyncCallbackAdapter<String>(infoPanel) { @Override public void customOnSuccess(final RpcResult<String> rpcResult) { final String authorizationKey = rpcResult.getValue(); if (authorizationKey == null) return; add(ClientUtils.createVerticalEmptyWidget(5)); add(new Label("Your current Authorization key: ")); add(ClientUtils.createVerticalEmptyWidget(15)); final Label authorizationKeylabel = new Label(authorizationKey); authorizationKeylabel.addStyleName("authKey"); add(authorizationKeylabel); add(ClientUtils.createVerticalEmptyWidget(15)); final Button generateNewKeyButton = new Button("Generate new Authorization key"); ClientUtils.setWidgetIcon(generateNewKeyButton, "fugue/license-key.png", null, "#ffaa77"); if (!checkPermission(Permission.CHANGE_AUTHORIZATION_KEY)) generateNewKeyButton.setEnabled(false); else generateNewKeyButton.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { generateNewKeyButton.setEnabled(false); SERVICE_ASYNC.generateNewAuthorizationKey(getSharedAccount(), new AsyncCallbackAdapter<String>(infoPanel) { @Override public void customOnSuccess(final RpcResult<String> rpcResult) { final String newAuthorizationKey = rpcResult.getValue(); if (newAuthorizationKey != null) authorizationKeylabel.setText(newAuthorizationKey); } @Override public void customOnEnd() { generateNewKeyButton.setEnabled(true); }; }); } }); add(generateNewKeyButton); add(ClientUtils.createVerticalEmptyWidget(25)); final Label noteLabel = new Label( "Note: If you generate a new Authorization key, you have to set the new key in your Sc2gears, else calls that require an Authorization key (like storing replays) will be rejected. By generating a new Authorization key the old key becomes invalid."); noteLabel.setWidth("600px"); add(noteLabel); } }); }
From source file:ilarkesto.gwt.client.desktop.fields.AEditableTextBoxField.java
License:Open Source License
@Override public IsWidget createDisplayWidget() { String text = getDisplayValue(); if (text != null && isMasked()) text = "**********"; if (text != null) { String suffix = getSuffix(); if (suffix != null) text += " " + suffix; }/*from ww w .j av a2 s .c om*/ Label label = new Label(); if (text == null) { text = getAlternateValueIfValueIsNull(); label.getElement().getStyle().setColor("#AAA"); } else { String suffix = getDisplaySuffix(); if (suffix != null) text += suffix; } label.setText(text); label.getElement().getStyle().setWhiteSpace(WhiteSpace.PRE_WRAP); if (isDisplayValueAlignedRight()) label.getElement().getStyle().setTextAlign(TextAlign.RIGHT); if (isDisplayValueNoWrap()) label.getElement().getStyle().setWhiteSpace(WhiteSpace.NOWRAP); return label; }