List of usage examples for com.google.gwt.event.logical.shared ValueChangeEvent getValue
public T getValue()
From source file:com.google.gwt.sample.contacts.client.AppController.java
public void onValueChange(ValueChangeEvent<String> event) { String token = event.getValue(); if (token != null) { if (token.equals("list")) { GWT.runAsync(new RunAsyncCallback() { public void onFailure(Throwable caught) { }//from w w w .ja v a 2 s . co m public void onSuccess() { // lazily initialize our views, and keep them around to be reused // if (contactsView == null) { contactsView = new ContactsViewImpl<ContactDetails>(); } new ContactsPresenter(rpcService, eventBus, contactsView, ContactsColumnDefinitionsFactory.getContactsColumnDefinitions()).go(container); } }); } else if (token.equals("add") || token.equals("edit")) { GWT.runAsync(new RunAsyncCallback() { public void onFailure(Throwable caught) { } public void onSuccess() { // lazily initialize our views, and keep them around to be reused // if (editContactView == null) { editContactView = new EditContactView(); } new EditContactPresenter(rpcService, eventBus, editContactView).go(container); } }); } } }
From source file:com.google.gwt.sample.dynatablemvp.client.AppController.java
@Override public void onValueChange(ValueChangeEvent<String> event) { String token = event.getValue(); if (token != null) { DynaTableMvpPresenter presenter = null; if (token != null && token.equalsIgnoreCase("list")) { // Add remote logging handler RequestFactoryLogHandler.LoggingRequestProvider provider = new RequestFactoryLogHandler.LoggingRequestProvider() { public LoggingRequest getLoggingRequest() { return requests.loggingRequest(); }/* w ww.j a v a 2 s. co m*/ }; final ErrorDialog errorDialog = new ErrorDialog(); Logger.getLogger("").addHandler(errorDialog.getHandler()); Logger.getLogger("") .addHandler(new RequestFactoryLogHandler(provider, Level.WARNING, new ArrayList<String>())); container.add(errorDialog); presenter = new DynaTableMvpPresenter(requests, eventBus, new DynaTableMvpView(), new BrowserManager()); personEditor = new PersonEditorWorkflowPresenter(requests, eventBus, new PersonEditorWorkflow(), presenter.getFavoritesManager()); } if (presenter != null) { presenter.go(container); personEditor.go(container); } } }
From source file:com.google.gwt.sample.dynatablemvp.client.presenter.DayCheckBoxPresenter.java
protected void bind() { // logger.fine("bind() executed for day: " + display.getDay() + ";"); display.getCheckBox().addValueChangeHandler(new ValueChangeHandler<Boolean>() { public void onValueChange(ValueChangeEvent<Boolean> event) { eventBus.fireEvent(new FilterChangeEvent(display.getDay(), event.getValue())); }//from ww w .j a va 2 s. c o m }); eventBus.addHandler(FilterChangeEvent.TYPE, new FilterChangeEvent.Handler() { @Override public void onFilterChanged(FilterChangeEvent e) { if (e.getDay() == display.getDay()) { display.setValue(e.isSelected()); // logger.fine("onFilterChanged() executed: day=" // + e.getDay() + "; isSelected=" // + e.isSelected()+";"); } } }); }
From source file:com.google.gwt.sample.expenses.client.place.ProxyListPlacePicker.java
License:Apache License
public void onValueChange(ValueChangeEvent<ProxyListPlace> event) { placeController.goTo(event.getValue()); }
From source file:com.google.gwt.sample.showcase.client.content.widgets.CwDatePicker.java
License:Apache License
/** * Initialize this example./* w w w. ja v a 2s . c o m*/ */ @SuppressWarnings("deprecation") @ShowcaseSource @Override public Widget onInitialize() { // 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); // Create a DateBox DateTimeFormat dateFormat = DateTimeFormat.getLongDateFormat(); DateBox dateBox = new DateBox(); dateBox.setFormat(new DateBox.DefaultFormat(dateFormat)); // Combine the widgets into a panel and return them VerticalPanel vPanel = new VerticalPanel(); vPanel.add(new HTML(constants.cwDatePickerLabel())); vPanel.add(text); vPanel.add(datePicker); vPanel.add(new HTML(constants.cwDatePickerBoxLabel())); vPanel.add(dateBox); return vPanel; }
From source file:com.google.gwt.sample.showcase.client.ShowcaseShell.java
License:Apache License
/** * Set the content to display.//from w w w. j a va2 s . co m * * @param content the content */ public void setContent(final ContentWidget content) { // Clear the old handler. if (contentSourceHandler != null) { contentSourceHandler.removeHandler(); contentSourceHandler = null; } this.content = content; if (content == null) { tabExample.setVisible(false); tabStyle.setVisible(false); tabSource.setVisible(false); tabSourceList.setVisible(false); contentPanel.setWidget(null); return; } // Setup the options bar. tabExample.setVisible(true); tabStyle.setVisible(content.hasStyle()); tabSource.setVisible(true); /* * Show the list of raw source files if there are any. We need to add at * least one option to the list for crawlability. If we do not, HtmlUnit * innerHtml will close the select tag in the open tag (ie, use a forward * slash instead of a separate close tag) which most browsers parse * incorrectly. */ tabSourceList.clear(); tabSourceList.addItem("Example"); List<String> rawFilenames = content.getRawSourceFilenames(); if (rawFilenames.size() > 0) { String text = tabSource.getText(); if (!text.endsWith(":")) { tabSource.setText(text + ":"); } tabSourceList.setVisible(true); for (String filename : rawFilenames) { tabSourceList.addItem(filename); } tabSourceList.setSelectedIndex(0); } else { String text = tabSource.getText(); if (text.endsWith(":")) { tabSource.setText(text.substring(0, text.length() - 1)); } tabSourceList.setVisible(false); } // Handle user requests for raw source. contentSourceHandler = content.addValueChangeHandler(new ValueChangeHandler<String>() { public void onValueChange(ValueChangeEvent<String> event) { // Select the file in the list box. String filename = event.getValue(); int index = content.getRawSourceFilenames().indexOf(filename); tabSourceList.setSelectedIndex(index + 1); // Show the file. showSourceFile(); } }); // Show the widget. showExample(); }
From source file:com.google.gwt.sample.stockwatcher.client.Login.java
@UiHandler("loginBox") void handleLoginChange(ValueChangeEvent<String> event) { if (event.getValue().length() < 6) { completionLabel1.setText("Login too short (Size must be > 6)"); tooShort = true;// ww w . ja v a 2s . c om } else { tooShort = false; completionLabel1.setText(""); } }
From source file:com.google.gwt.sample.stockwatcher.client.Login.java
@UiHandler("passwordBox") void handlePasswordChange(ValueChangeEvent<String> event) { if (event.getValue().length() < 6) { tooShort = true;//from ww w .j a va 2 s .com completionLabel2.setText("Password too short (Size must be > 6)"); } else { tooShort = false; completionLabel2.setText(""); } }
From source file:com.google.gwt.sample.stockwatcher.client.NavigationHandler.java
/** * Currently supports:/*from w ww. j a v a2 s.c o m*/ * * found!{command}!... where command can be "newplayer" to show new player form * homepage * market * TODO: manual */ @Override public void onValueChange(ValueChangeEvent<String> event) { // We've extended ValueChangeEvent<String> so we can be sure event is a String (right?) String historyToken = event.getValue(); logger.log(Level.INFO, "NavigationHandler.onValueChange(" + historyToken + ") running"); appPage = ""; args = new String[] {}; appPageReference = null; command = ""; if (historyToken.contains("!")) { String[] parts = historyToken.split("!"); appPage = parts[0]; command = parts[1]; } else { appPage = historyToken; command = ""; } logger.log(Level.INFO, "appPage = " + appPage); logger.log(Level.INFO, "command = " + command); // Get a reference to the singleton ContentController ContentContainer contentContainer = ContentContainer.getInstance(); // Parse the history token if (appPage == "found") { logger.log(Level.INFO, "loading found page"); if (command == "newplayer") { logger.log(Level.INFO, "Revealing new player form"); foundpage.showNewPlayer(); } else { logger.log(Level.INFO, "Hiding new player form"); foundpage.hideNewPlayer(); } appPageReference = foundpage; } else if (historyToken == "homepage") { appPageReference = homepage; } // TODO: UN NULL THIS else if (historyToken == "manual") { } // TODO: UN NULL THIS else if (historyToken == "market") { appPageReference = marketpage; } logger.log(Level.INFO, "NavigationHandler redrawing content div"); contentContainer.setDivContent(appPageReference, "content"); }
From source file:com.google.livingstories.client.contentmanager.ContentItemManager.java
License:Apache License
/** creates a panel of datePickers in a popup, including setting up appropriate event handling.*/ private Widget createDatePickerPanel() { datePopup = new PopupPanel(false /* doesn't close if you click away */, true /* modal */); // TODO: Make it possible for the user to cancel, either by clicking away from // the popup panel or by hitting an explicit cancel button. startDatePicker = new DatePicker(); startTime = new TextBox(); hasSeparateEndDate = new CheckBox("Event has a separate end date & time"); endDatePicker = new DatePicker(); endTime = new TextBox(); endTime.setEnabled(false);/* w w w .j a v a2s. c o m*/ Grid table = new Grid(5, 2); table.setWidget(1, 0, new Label("Start date:")); table.setWidget(2, 0, startDatePicker); table.setWidget(3, 0, new Label("Start time:")); table.setWidget(4, 0, startTime); table.setWidget(0, 1, hasSeparateEndDate); table.setWidget(1, 1, new Label("End date:")); table.setWidget(2, 1, endDatePicker); table.setWidget(3, 1, new Label("End time:")); table.setWidget(4, 1, endTime); Button okButton = new Button("OK"); final InlineLabel problemLabel = new InlineLabel(""); problemLabel.setStylePrimaryName("serverResponseLabelError"); FlowPanel panel = new FlowPanel(); panel.add(table); panel.add(new Label("Event time may be blank, or should be entered as, e.g., 3:00 PM.")); panel.add(okButton); panel.add(problemLabel); hasSeparateEndDate.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { boolean isChecked = event.getValue().booleanValue(); // endDatePicker.setEnabled(isChecked); -- if only the API supported it. :-( endTime.setEnabled(isChecked); } }); okButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { Date endDateTime = getEndDateTime(); if (endDateTime != null && endDateTime.before(getStartDateTime())) { problemLabel.setText("End date/time cannot be before start date/time"); } else { problemLabel.setText(""); datePopup.hide(); setDateTriggerText(); } } }); datePopup.setWidget(panel); return datePopup; }