List of usage examples for com.google.gwt.event.logical.shared ValueChangeEvent getValue
public T getValue()
From source file:fr.mncc.gwttoolbox.router.client.Router.java
License:Open Source License
@Override public void onValueChange(ValueChangeEvent<String> event) { if (current_ != null) { current_.leave();//w ww.jav a 2 s . c om current_ = null; } String token = event.getValue(); if (token == null || token.isEmpty()) { if (fallback_ != null) { current_ = fallback_; current_.enter(""); } GWT.log("undefined route"); return; } // Extract route name String route = token; if (token.startsWith("!/")) { route = token.substring(2); } else if (token.startsWith("!") || token.startsWith("/")) { route = token.substring(1); } // Extract route arguments // Token format is either route?arg1&arg2&arg3 or route/arg1/arg2/arg3 String arguments = ""; int firstParameterIndex = route.indexOf("/"); if (firstParameterIndex < 0) firstParameterIndex = route.indexOf("?"); if (firstParameterIndex >= 0) { arguments = route.substring(firstParameterIndex); route = route.substring(0, firstParameterIndex); } if (!routes_.containsKey(route)) { if (fallback_ != null) { current_ = fallback_; current_.enter(""); } GWT.log("route " + token + " not found"); return; } current_ = routes_.get(route); if (current_ != null) { current_.enter(arguments); recordAnalytics(token); } else { GWT.log("route " + token + " found without callback"); } }
From source file:fr.mncc.gwttoolbox.routing.client.RouteController.java
License:Open Source License
/** * Called when goTo() is called or the prev/next button of the browser is hit. * * @param event/*from ww w.j a v a2 s . c om*/ */ @Override public void onValueChange(ValueChangeEvent<String> event) { /* * token is of one of the following forms: * * 1. routeName * 2. routeName?xxx * 3. !routeName * 4. !routeName?xxx */ String token = event.getValue(); if (token == null) { if (rescueCallback_ != null) rescueCallback_.execute(token); } else { // Remove ! before route name if any if (token.indexOf("!") == 0) token = token.substring(1); // Update analytics if any if (!UA_.isEmpty() && !domainName_.isEmpty()) recordAnalyticsHit(UA_, domainName_, token); // Extract the route name and arguments String routeName; String arguments; int questionMarkIndex = token.indexOf("?"); if (questionMarkIndex < 0) { routeName = token; arguments = ""; } else { routeName = token.substring(0, questionMarkIndex); arguments = token.substring(questionMarkIndex + 1); } // Call the right callback according to route name if (routes_.containsKey(routeName)) routes_.get(routeName).execute(arguments); else { if (rescueCallback_ != null) rescueCallback_.execute(token); } } }
From source file:fr.putnami.pwt.core.widget.client.base.AbstractInputSelect.java
License:Open Source License
@Override public void onValueChange(ValueChangeEvent<U> event) { if (event != null && event.getSource() == this) { this.dropdown.setLabel(this.selectRenderer.renderSelection(event.getValue())); }// ww w . j av a2s. c om }
From source file:fr.putnami.pwt.core.widget.client.InputDate.java
License:Open Source License
private void toggleDatePicker() { if (this.datePicker == null) { this.datePicker = new InputDatePicker(); this.datePicker.addValueChangeHandler(new ValueChangeHandler<Date>() { @Override/*from w w w . j a v a2 s . c om*/ public void onValueChange(ValueChangeEvent<Date> event) { InputDate.this.edit(event.getValue(), true); InputDate.this.dateBox.setFocus(true); } }); this.compositeFocusHelper.addFocusPartner(this.datePicker.getElement()); } this.datePicker.togglePopup(this, this.calendarButton); try { this.datePicker.setValue(this.flush()); } catch (IllegalArgumentException e) { this.datePicker.setValue(new Date()); } }
From source file:fr.putnami.pwt.core.widget.client.InputSlider.java
License:Open Source License
@Override public void onValueChange(ValueChangeEvent<T> event) { this.popover.setText(this.render(event.getValue())); this.popover.show(); }
From source file:fr.putnami.pwt.doc.client.page.ajaxbot.AjaxBotIndexingPage.java
License:Open Source License
@UiHandler("switchBuild") void onSwitch(ValueChangeEvent<String> event) { if ("MAVEN".equals(event.getValue())) { this.buildGradlePanel.setVisible(false); this.buildMavenPanel.setVisible(true); } else {//from ww w . ja v a2 s . c om this.buildGradlePanel.setVisible(true); this.buildMavenPanel.setVisible(false); } }
From source file:fr.putnami.pwt.doc.client.page.starting.StartSamplesView.java
License:Open Source License
@UiHandler("switchBuild") void onSwitch(ValueChangeEvent<String> event) { if ("MAVEN".equals(event.getValue())) { this.gradlePanel.setVisible(false); this.mavenPanel.setVisible(true); } else {// ww w .j a va2 s.co m this.gradlePanel.setVisible(true); this.mavenPanel.setVisible(false); } }
From source file:fr.putnami.pwt.doc.client.page.starting.StartScratchView.java
License:Open Source License
@UiHandler("switchBuild") void onSwitch(ValueChangeEvent<String> event) { if ("MAVEN".equals(event.getValue())) { this.buildGradlePanel.setVisible(false); this.runGradlePanel.setVisible(false); this.buildMavenPanel.setVisible(true); this.runMavenPanel.setVisible(true); } else {//from w ww.j ava 2 s. c o m this.buildGradlePanel.setVisible(true); this.runGradlePanel.setVisible(true); this.buildMavenPanel.setVisible(false); this.runMavenPanel.setVisible(false); } }
From source file:geogebra.web.gui.view.algebra.RadioButtonTreeItem.java
License:Open Source License
/** * Creates a new RadioButtonTreeItem for displaying/editing an existing * GeoElement/*from w w w. ja v a 2 s . c o m*/ * * @param ge * the existing GeoElement to display/edit * @param showUrl * the marble to be shown when the GeoElement is visible * @param hiddenUrl * the marble to be shown when the GeoElement is invisible */ public RadioButtonTreeItem(GeoElement ge, SafeUri showUrl, SafeUri hiddenUrl) { super(); getElement().setDraggable(Element.DRAGGABLE_TRUE); geo = ge; kernel = geo.getKernel(); app = (AppW) kernel.getApplication(); av = app.getAlgebraView(); selection = app.getSelectionManager(); addStyleName("elem"); addStyleName("panelRow"); // setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); // setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); radio = new Marble(showUrl, hiddenUrl, this); radio.setStyleName("marble"); radio.setEnabled(ge.isEuclidianShowable()); radio.setChecked(ge.isEuclidianVisible()); marblePanel = new FlowPanel(); marblePanel.add(radio); add(marblePanel); // Sliders if (showSliderOrTextBox && app.isPrerelease() && geo instanceof GeoNumeric && ((GeoNumeric) geo).isShowingExtendedAV()) { if (!geo.isEuclidianVisible()) { // number inserted via input bar // -> initialize min/max etc. geo.setEuclidianVisible(true); geo.setEuclidianVisible(false); } slider = new SliderW(((GeoNumeric) geo).getIntervalMin(), (int) ((GeoNumeric) geo).getIntervalMax()); slider.setValue(((GeoNumeric) geo).getValue()); slider.setMinorTickSpacing(geo.getAnimationStep()); slider.addValueChangeHandler(new ValueChangeHandler<Double>() { public void onValueChange(ValueChangeEvent<Double> event) { ((GeoNumeric) geo).setValue(event.getValue()); geo.updateCascade(); // updates other views (e.g. Euclidian) kernel.notifyRepaint(); } }); sliderPanel = new FlowPanel(); add(sliderPanel); if (geo.isAnimatable()) { ImageResource imageresource = geo.isAnimating() ? AppResources.INSTANCE.nav_pause() : AppResources.INSTANCE.nav_play(); playButton = new Image(imageresource); playButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { boolean newValue = !(geo.isAnimating() && app.getKernel().getAnimatonManager().isRunning()); geo.setAnimating(newValue); playButton.setResource( newValue ? AppResources.INSTANCE.nav_pause() : AppResources.INSTANCE.nav_play()); geo.updateRepaint(); if (geo.isAnimating()) { geo.getKernel().getAnimatonManager().startAnimation(); } } }); marblePanel.add(playButton); } } SpanElement se = DOM.createSpan().cast(); updateNewStatic(se); updateColor(se); ihtml = new InlineHTML(); ihtml.addDoubleClickHandler(this); ihtml.addClickHandler(this); ihtml.addMouseMoveHandler(this); ihtml.addMouseDownHandler(this); ihtml.addMouseOverHandler(this); ihtml.addMouseOutHandler(this); ihtml.addTouchStartHandler(this); ihtml.addTouchMoveHandler(this); ihtml.addTouchEndHandler(this); addSpecial(ihtml); ihtml.getElement().appendChild(se); SpanElement se2 = DOM.createSpan().cast(); se2.appendChild(Document.get().createTextNode("\u00A0\u00A0\u00A0\u00A0")); ihtml.getElement().appendChild(se2); // String text = ""; if (showSliderOrTextBox && app.isPrerelease() && geo instanceof GeoBoolean) { // CheckBoxes checkBox = new CheckBox(); checkBox.setValue(((GeoBoolean) geo).getBoolean()); add(checkBox); checkBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() { public void onValueChange(ValueChangeEvent<Boolean> event) { ((GeoBoolean) geo).setValue(event.getValue()); geo.updateCascade(); // updates other views (e.g. Euclidian) kernel.notifyRepaint(); } }); // use only the name of the GeoBoolean getBuilder(se).append(geo.getLabel(StringTemplate.defaultTemplate)); } else if (geo.isIndependent()) { geo.getAlgebraDescriptionTextOrHTMLDefault(getBuilder(se)); } else { switch (kernel.getAlgebraStyle()) { case Kernel.ALGEBRA_STYLE_VALUE: geo.getAlgebraDescriptionTextOrHTMLDefault(getBuilder(se)); break; case Kernel.ALGEBRA_STYLE_DEFINITION: geo.addLabelTextOrHTML(geo.getDefinitionDescription(StringTemplate.defaultTemplate), getBuilder(se)); break; case Kernel.ALGEBRA_STYLE_COMMAND: geo.addLabelTextOrHTML(geo.getCommandDescription(StringTemplate.defaultTemplate), getBuilder(se)); break; } } // if enabled, render with LaTeX if (av.isRenderLaTeX() && kernel.getAlgebraStyle() == Kernel.ALGEBRA_STYLE_VALUE) { String latexStr = geo.getLaTeXAlgebraDescription(true, StringTemplate.latexTemplateMQ); seNoLatex = se; if ((latexStr != null) && geo.isLaTeXDrawableGeo() && (geo.isGeoList() ? !((GeoList) geo).isMatrix() : true)) { this.needsUpdate = true; av.repaintView(); } } else { seNoLatex = se; } // FIXME: geo.getLongDescription() doesn't work // geo.getKernel().getApplication().setTooltipFlag(); // se.setTitle(geo.getLongDescription()); // geo.getKernel().getApplication().clearTooltipFlag(); longTouchManager = LongTouchManager.getInstance(); setDraggable(); }
From source file:gov.nist.spectrumbrowser.admin.AddFftPowerSensorBand.java
License:Open Source License
public void draw() { verticalPanel.clear();/*from w w w . j av a 2 s . c om*/ HTML title = new HTML("<h2>Add a new band for sensor " + sensor.getSensorId() + "</h2>"); verticalPanel.add(title); final Grid grid = new Grid(8, 3); grid.setCellPadding(2); grid.setCellSpacing(2); grid.setBorderWidth(2); grid.setText(0, 0, "Setting"); grid.setText(0, 1, "Value"); grid.setText(0, 2, "Info"); for (int i = 0; i < grid.getRowCount(); i++) { for (int j = 0; j < grid.getColumnCount(); j++) { grid.getCellFormatter().setHorizontalAlignment(i, j, HasHorizontalAlignment.ALIGN_CENTER); grid.getCellFormatter().setVerticalAlignment(i, j, HasVerticalAlignment.ALIGN_MIDDLE); } } int row = 1; grid.setText(row, 0, "System To Detect"); TextBox sysToDetectTextBox = new TextBox(); sysToDetectTextBox.setValue(threshold.getSystemToDetect()); sysToDetectTextBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String value = event.getValue(); verified = false; try { threshold.setSystemToDetect(value); } catch (IllegalArgumentException ex) { Window.alert(ex.getMessage()); } } }); grid.setWidget(row, 1, sysToDetectTextBox); row++; grid.setText(row, 0, "Min Freq. (Hz)"); TextBox minFreqHzTextBox = new TextBox(); minFreqHzTextBox.setEnabled(true); minFreqHzTextBox.setText(Long.toString(threshold.getMinFreqHz())); minFreqHzTextBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String val = event.getValue(); verified = false; try { long newVal = (long) Double.parseDouble(val); threshold.setMinFreqHz(newVal); } catch (NumberFormatException ex) { Window.alert("Please enter a valid number"); } catch (IllegalArgumentException ex) { Window.alert(ex.getMessage()); } } }); grid.setWidget(row, 1, minFreqHzTextBox); //2 row++; grid.setText(row, 0, "Max Freq. (Hz)"); TextBox maxFreqHzTextBox = new TextBox(); maxFreqHzTextBox.setEnabled(true); maxFreqHzTextBox.setText(Long.toString(threshold.getMaxFreqHz())); maxFreqHzTextBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String val = event.getValue(); verified = false; try { long newVal = (long) Double.parseDouble(val); threshold.setMaxFreqHz(newVal); if (threshold.getMinFreqHz() >= 0 && threshold.getMaxFreqHz() > 0) { channelCountTextBox.setEnabled(true); } } catch (NumberFormatException ex) { Window.alert("Please enter a valid number"); } catch (IllegalArgumentException ex) { Window.alert(ex.getMessage()); } } }); grid.setWidget(row, 1, maxFreqHzTextBox);//3 row++; grid.setText(row, 0, "Channel Count"); channelCountTextBox = new TextBox(); channelCountTextBox.setEnabled(false); channelCountTextBox.setText(Long.toString(threshold.getChannelCount())); channelCountTextBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String val = event.getValue(); verified = false; try { long newVal = Long.parseLong(val); threshold.setChannelCount(newVal); thresholdTextBox.setEnabled(true); } catch (NumberFormatException ex) { Window.alert("Please enter a valid number"); } catch (IllegalArgumentException ex) { Window.alert(ex.getMessage()); } } }); grid.setWidget(row, 1, channelCountTextBox);//4 row++; grid.setText(row, 0, "Occupancy Threshold (dBm/Hz)"); thresholdTextBox = new TextBox(); thresholdTextBox.setText("UNKNOWN"); thresholdTextBox.setEnabled(false); thresholdTextBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String val = event.getValue(); verified = false; try { double newValue = Double.parseDouble(val); threshold.setThresholdDbmPerHz(newValue); } catch (NumberFormatException ex) { Window.alert("Please enter a valid number"); } catch (IllegalArgumentException ex) { Window.alert(ex.getMessage()); } } }); grid.setWidget(row, 1, thresholdTextBox); //5 row++; grid.setText(row, 0, "Sampling Rate (Samples/S) "); TextBox samplingRateTextBox = new TextBox(); samplingRateTextBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String val = event.getValue(); verified = false; try { long newVal = (long) Double.parseDouble(val); threshold.setSamplingRate(newVal); } catch (NumberFormatException ex) { Window.alert("Please enter a valid number"); } catch (IllegalArgumentException ex) { Window.alert(ex.getMessage()); } } }); grid.setWidget(row, 1, samplingRateTextBox);//6 row++; grid.setText(row, 0, "FFT Size"); TextBox fftSizeTextBox = new TextBox(); fftSizeTextBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String val = event.getValue(); verified = false; try { long newVal = Long.parseLong(val); threshold.setFftSize(newVal); } catch (NumberFormatException ex) { Window.alert("Please enter a valid number"); } catch (IllegalArgumentException ex) { Window.alert(ex.getMessage()); } } }); grid.setWidget(row, 1, fftSizeTextBox); row++; verticalPanel.add(grid); HorizontalPanel horizontalPanel = new HorizontalPanel(); final Button okButton = new Button("Check Entries"); okButton.setTitle("Check entered values and print additional information"); final Button applyButton = new Button("Apply"); applyButton.setTitle("Please Chek Entries and Apply to update server entries"); applyButton.setEnabled(false); horizontalPanel.add(okButton); okButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // TODO Auto-generated method stub if (!threshold.validate()) { Window.alert("Error in one or more entries"); } else { long channelCount = threshold.getChannelCount(); grid.setText(4, 2, "Resolution BW = " + ((threshold.getMaxFreqHz() - threshold.getMinFreqHz()) / (1000 * channelCount)) + " " + " KHz"); double thresholdDbmPerHz = threshold.getThresholdDbmPerHz(); double resolutionBw = (threshold.getMaxFreqHz() - threshold.getMinFreqHz()) / channelCount; grid.setText(5, 2, "Threshold (dBm) = " + (thresholdDbmPerHz + 10 * Math.log10(resolutionBw))); verified = true; applyButton.setEnabled(true); } } }); horizontalPanel.add(applyButton); applyButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (!threshold.validate()) { Window.alert("Error in one or more entries"); } else { sensor.addNewThreshold(AddFftPowerSensorBand.this.threshold.getSystemToDetect(), threshold.getThreshold()); Admin.getAdminService().updateSensor(sensor.toString(), sensorConfig); sensorThresholds.draw(); } } }); Button cancelButton = new Button("Cancel"); horizontalPanel.add(cancelButton); cancelButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { sensorThresholds.draw(); } }); Button logoffButton = new Button("Log Off"); horizontalPanel.add(logoffButton); logoffButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { admin.logoff(); } }); verticalPanel.add(horizontalPanel); }