List of usage examples for com.google.gwt.event.logical.shared ValueChangeEvent getValue
public T getValue()
From source file:com.gmail.cjbooms.thesis.pythonappengine.client.menus.git.GitCommitLocalChangesDialogWidget.java
License:Open Source License
private VerticalPanel createCommitterNameEntry() { VerticalPanel committerInput = new VerticalPanel(); committerInput.add(new Label("Committer Name:")); TextBox committerNameTextBox = new TextBox(); committerNameTextBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override// w w w. j a v a2 s. c o m public void onValueChange(ValueChangeEvent<String> event) { committerName = event.getValue(); } }); committerInput.add(committerNameTextBox); return committerInput; }
From source file:com.gmail.cjbooms.thesis.pythonappengine.client.menus.git.GitCommitLocalChangesDialogWidget.java
License:Open Source License
private VerticalPanel createCommitterEmailEntry() { VerticalPanel committerInput = new VerticalPanel(); committerInput.add(new Label("Committer Email:")); TextBox committerEmailTextBox = new TextBox(); committerEmailTextBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override/*from w w w.j a v a 2 s. c om*/ public void onValueChange(ValueChangeEvent<String> event) { committerEmail = event.getValue(); } }); committerInput.add(committerEmailTextBox); return committerInput; }
From source file:com.gmail.cjbooms.thesis.pythonappengine.client.menus.git.GitCommitLocalChangesDialogWidget.java
License:Open Source License
/** * Create and return the Text holder for the log messsage * @return/* ww w. ja va 2s.c o m*/ */ private VerticalPanel createLogMessageTextBox() { VerticalPanel logPanel = new VerticalPanel(); logPanel.add(new Label("Enter Log Message:")); TextArea logMessageBox = new TextArea(); logMessageBox.setCharacterWidth(40); logMessageBox.setVisibleLines(4); logMessageBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { logMessage = event.getValue(); } }); logPanel.add(logMessageBox); logPanel.setSpacing(10); logPanel.setHeight("100px"); return logPanel; }
From source file:com.gmail.cjbooms.thesis.pythonappengine.client.menus.git.GitPushChangesDialogWidget.java
License:Open Source License
/** * Create a Suggestion Box for GIT URLS// w ww . j a v a 2s.com * TODO - Populate the suggestion oracle dynamically with previously used GIT repos * * @return */ private HorizontalPanel createGitURLSuggestionBox() { MultiWordSuggestOracle gitURLOracle = new MultiWordSuggestOracle(); gitURLOracle.add("https://cjbooms@github.com/cjbooms/helloworld.git"); gitURLSuggestBox = new SuggestBox(gitURLOracle); Label gitURLSuggestBoxLabel = new Label("Enter The complete GIT URL"); gitURLSuggestBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> stringValueChangeEvent) { gitURLEntered = stringValueChangeEvent.getValue(); } }); gitURLSuggestBox.addSelectionHandler(new SelectionHandler<SuggestOracle.Suggestion>() { @Override public void onSelection(SelectionEvent<SuggestOracle.Suggestion> suggestionSelectionEvent) { gitURLEntered = suggestionSelectionEvent.getSelectedItem().getReplacementString(); } }); return createHorizontalHolder(gitURLSuggestBox, gitURLSuggestBoxLabel); }
From source file:com.google.api.explorer.client.auth.AuthView.java
License:Apache License
@UiHandler("authToggle") void authToggled(ValueChangeEvent<Boolean> event) { if (event.getValue()) { presenter.clickEnableAuth();//from w w w .java 2 s . c o m } else { presenter.clickDisableAuth(); } }
From source file:com.google.api.explorer.client.parameter.schema.FieldsEditor.java
License:Apache License
public FieldsEditor(ApiService service, String key) { super(""); this.service = service; this.key = key; root = new CheckBox(key.isEmpty() ? "Select all/none" : key); root.setValue(false);// ww w .j av a2 s. c om root.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { for (HasValue<Boolean> checkBox : children.values()) { checkBox.setValue(event.getValue(), true); } } }); add(root); }
From source file:com.google.appinventor.client.editor.simple.SimpleVisibleComponentsPanel.java
License:Open Source License
/** * Creates new component design panel for visible components. * * @param nonVisibleComponentsPanel corresponding panel for non-visible * components *///from ww w . j a v a2 s. co m public SimpleVisibleComponentsPanel(final SimpleEditor editor, SimpleNonVisibleComponentsPanel nonVisibleComponentsPanel) { this.nonVisibleComponentsPanel = nonVisibleComponentsPanel; projectEditor = editor.getProjectEditor(); // Initialize UI phoneScreen = new VerticalPanel(); phoneScreen.setStylePrimaryName("ode-SimpleFormDesigner"); checkboxShowHiddenComponents = new CheckBox(MESSAGES.showHiddenComponentsCheckbox()) { @Override protected void onLoad() { // onLoad is called immediately after a widget becomes attached to the browser's document. boolean showHiddenComponents = Boolean.parseBoolean( projectEditor.getProjectSettingsProperty(SettingsConstants.PROJECT_YOUNG_ANDROID_SETTINGS, SettingsConstants.YOUNG_ANDROID_SETTINGS_SHOW_HIDDEN_COMPONENTS)); checkboxShowHiddenComponents.setValue(showHiddenComponents); } }; checkboxShowHiddenComponents.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { boolean isChecked = event.getValue(); // auto-unbox from Boolean to boolean projectEditor.changeProjectSettingsProperty(SettingsConstants.PROJECT_YOUNG_ANDROID_SETTINGS, SettingsConstants.YOUNG_ANDROID_SETTINGS_SHOW_HIDDEN_COMPONENTS, isChecked ? "True" : "False"); if (form != null) { form.refresh(); } } }); phoneScreen.add(checkboxShowHiddenComponents); checkboxPhoneTablet = new CheckBox(MESSAGES.previewPhoneSize()) { @Override protected void onLoad() { // onLoad is called immediately after a widget becomes attached to the browser's document. boolean showPhoneTablet = Boolean.parseBoolean( projectEditor.getProjectSettingsProperty(SettingsConstants.PROJECT_YOUNG_ANDROID_SETTINGS, SettingsConstants.YOUNG_ANDROID_SETTINGS_PHONE_TABLET)); checkboxPhoneTablet.setValue(showPhoneTablet); changeFormPreviewSize(showPhoneTablet); } }; checkboxPhoneTablet.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { boolean isChecked = event.getValue(); // auto-unbox from Boolean to boolean projectEditor.changeProjectSettingsProperty(SettingsConstants.PROJECT_YOUNG_ANDROID_SETTINGS, SettingsConstants.YOUNG_ANDROID_SETTINGS_PHONE_TABLET, isChecked ? "True" : "False"); changeFormPreviewSize(isChecked); } }); phoneScreen.add(checkboxPhoneTablet); initWidget(phoneScreen); }
From source file:com.google.appinventor.client.explorer.youngandroid.ReportList.java
License:Open Source License
/** * Creates a new ProjectList//w w w . j ava 2s . c o m */ public ReportList() { galleryClient = GalleryClient.getInstance(); // Initialize UI panel = new VerticalPanel(); panel.setWidth("100%"); HorizontalPanel checkBoxPanel = new HorizontalPanel(); checkBoxPanel.addStyleName("all-reports"); checkBox = new CheckBox(); checkBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { boolean isChecked = event.getValue(); // auto-unbox from Boolean to boolean //reset start position reportAllRecentCounter = 0; reportRecentCounter = 0; buttonNext.setVisible(true); if (isChecked) { initializeAllReports(); } else { initializeReports(); } } }); checkBoxPanel.add(checkBox); Label checkBoxText = new Label(MESSAGES.moderationShowResolvedReports()); checkBoxPanel.add(checkBoxText); panel.add(checkBoxPanel); selectedGalleryAppReports = new ArrayList<GalleryAppReport>(); ReportWidgets = new HashMap<GalleryAppReport, ReportWidgets>(); table = new Grid(1, 9); // The table initially contains just the header row. table.addStyleName("ode-ModerationTable"); table.setWidth("100%"); table.setCellSpacing(0); buttonNext = new Label(); buttonNext.setText(MESSAGES.galleryMoreReports()); buttonNext.addClickHandler(new ClickHandler() { // @Override public void onClick(ClickEvent event) { final OdeAsyncCallback<GalleryReportListResult> callback = new OdeAsyncCallback<GalleryReportListResult>( // failure message MESSAGES.galleryError()) { @Override public void onSuccess(GalleryReportListResult reportListResult) { List<GalleryAppReport> reportList = reportListResult.getReports(); reports.addAll(reportList); for (GalleryAppReport report : reportList) { ReportWidgets.put(report, new ReportWidgets(report)); } refreshTable(reportListResult, false); } }; if (checkBox.isChecked()) { reportAllRecentCounter += NUMREPORTSSHOW; Ode.getInstance().getGalleryService().getAllAppReports(reportAllRecentCounter, NUMREPORTSSHOW, callback); } else { reportRecentCounter += NUMREPORTSSHOW; Ode.getInstance().getGalleryService().getRecentReports(reportRecentCounter, NUMREPORTSSHOW, callback); } } }); setHeaderRow(); panel.add(table); FlowPanel next = new FlowPanel(); buttonNext.addStyleName("active"); next.add(buttonNext); next.addStyleName("gallery-report-next"); panel.add(next); initWidget(panel); initializeReports(); }
From source file:com.google.appinventor.client.Ode.java
License:Open Source License
/** * Main entry point for Ode. Setting up the UI and the web service * connections.//from ww w. j a v a2 s. c o m */ @Override public void onModuleLoad() { Tracking.trackPageview(); // Handler for any otherwise unhandled exceptions GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() { @Override public void onUncaughtException(Throwable e) { OdeLog.xlog(e); if (AppInventorFeatures.sendBugReports()) { if (Window.confirm(MESSAGES.internalErrorReportBug())) { Window.open(BugReport.getBugReportLink(e), "_blank", ""); } } else { // Display a confirm dialog with error msg and if 'ok' open the debugging view if (Window.confirm(MESSAGES.internalErrorClickOkDebuggingView())) { Ode.getInstance().switchToDebuggingView(); } } } }); // Define bridge methods to Javascript JsonpConnection.defineBridgeMethod(); // Initialize global Ode instance instance = this; // Let's see if we were started with a repo= parameter which points to a template templatePath = Window.Location.getParameter("repo"); if (templatePath != null) { OdeLog.wlog("Got a template path of " + templatePath); templateLoadingFlag = true; } // Let's see if we were started with a galleryId= parameter which points to a template galleryId = Window.Location.getParameter("galleryId"); if (galleryId != null) { OdeLog.wlog("Got a galleryId of " + galleryId); galleryIdLoadingFlag = true; } // Get user information. OdeAsyncCallback<Config> callback = new OdeAsyncCallback<Config>( // failure message MESSAGES.serverUnavailable()) { @Override public void onSuccess(Config result) { config = result; user = result.getUser(); isReadOnly = user.isReadOnly(); // If user hasn't accepted terms of service, ask them to. if (!user.getUserTosAccepted() && !isReadOnly) { // We expect that the redirect to the TOS page should be handled // by the onFailure method below. The server should return a // "forbidden" error if the TOS wasn't accepted. ErrorReporter.reportError(MESSAGES.serverUnavailable()); return; } splashConfig = result.getSplashConfig(); if (result.getRendezvousServer() != null) { setRendezvousServer(result.getRendezvousServer()); } else { setRendezvousServer(YaVersion.RENDEZVOUS_SERVER); } userSettings = new UserSettings(user); // Gallery settings gallerySettings = new GallerySettings(); //gallerySettings.loadGallerySettings(); loadGallerySettings(); // Initialize project and editor managers // The project manager loads the user's projects asynchronously projectManager = new ProjectManager(); projectManager.addProjectManagerEventListener(new ProjectManagerEventAdapter() { @Override public void onProjectsLoaded() { projectManager.removeProjectManagerEventListener(this); // This handles any built-in templates stored in /war // Retrieve template data stored in war/templates folder and // and save it for later use in TemplateUploadWizard OdeAsyncCallback<String> templateCallback = new OdeAsyncCallback<String>( // failure message MESSAGES.createProjectError()) { @Override public void onSuccess(String json) { // Save the templateData TemplateUploadWizard.initializeBuiltInTemplates(json); // Here we call userSettings.loadSettings, but the settings are actually loaded // asynchronously, so this loadSettings call will return before they are loaded. // After the user settings have been loaded, openPreviousProject will be called. // We have to call this after the builtin templates have been loaded otherwise // we will get a NPF. userSettings.loadSettings(); } }; Ode.getInstance().getProjectService().retrieveTemplateData( TemplateUploadWizard.TEMPLATES_ROOT_DIRECTORY, templateCallback); } }); editorManager = new EditorManager(); // Initialize UI initializeUi(); topPanel.showUserEmail(user.getUserEmail()); } @Override public void onFailure(Throwable caught) { if (caught instanceof StatusCodeException) { StatusCodeException e = (StatusCodeException) caught; int statusCode = e.getStatusCode(); switch (statusCode) { case Response.SC_UNAUTHORIZED: // unauthorized => not on whitelist // getEncodedResponse() gives us the message that we wrote in // OdeAuthFilter.writeWhitelistErrorMessage(). Window.alert(e.getEncodedResponse()); return; case Response.SC_FORBIDDEN: // forbidden => need tos accept Window.open("/" + ServerLayout.YA_TOS_FORM, "_self", null); return; case Response.SC_PRECONDITION_FAILED: String locale = Window.Location.getParameter("locale"); if (locale == null || locale.equals("")) { Window.Location.replace("/login/"); } else { Window.Location.replace("/login/?locale=" + locale); } return; // likely not reached } } super.onFailure(caught); } }; // The call below begins an asynchronous read of the user's settings // When the settings are finished reading, various settings parsers // will be called on the returned JSON object. They will call various // other functions in this module, including openPreviousProject (the // previous project ID is stored in the settings) as well as the splash // screen displaying functions below. // // TODO(user): ODE makes too many RPC requests at startup time. Currently // we do 3 RPCs + 1 per project + 1 per open file. We should bundle some of // those with each other or with the initial HTML transfer. // // This call also stores our sessionId in the backend. This will be checked // when we go to save a file and if different file saving will be disabled // Newer sessions invalidate older sessions. userInfoService.getSystemConfig(sessionId, callback); History.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { openProject(event.getValue()); } }); // load project based on current url // TODO(sharon): Seems like a possible race condition here if the onValueChange // handler defined above gets called before the getSystemConfig call sets // userSettings. // The following line causes problems with GWT debugging, and commenting // it out doesn't seem to break things. //History.fireCurrentHistoryState(); }
From source file:com.google.caja.demos.playground.client.Playground.java
License:Apache License
public void onValueChange(ValueChangeEvent<String> change) { String historyToken = change.getValue(); if (null == historyToken || "".equals(historyToken)) return;//from w w w. j a va 2 s .co m loadSource(historyToken); }