List of usage examples for com.google.gwt.dom.client InputElement getName
public String getName()
From source file:com.cgxlib.xq.client.plugins.widgets.TextBoxBaseWidgetFactory.java
License:Apache License
protected void copyAttributes(Element src, Element dest) { InputElement source = src.cast(); InputElement destination = dest.cast(); destination.setAccessKey(source.getAccessKey()); destination.setDefaultValue(source.getDefaultValue()); destination.setDisabled(source.isDisabled()); if (source.getMaxLength() > 0) destination.setMaxLength(source.getMaxLength()); destination.setReadOnly(source.isReadOnly()); destination.setSize(source.getSize()); destination.setName(source.getName()); destination.setValue(source.getValue()); }
From source file:gwtquery.plugins.enhance.client.gwt.CheckBoxWidgetFactory.java
License:Apache License
protected void copyAttributes(InputElement source, InputElement destination) { destination.setAccessKey(source.getAccessKey()); destination.setDisabled(source.isDisabled()); destination.setSize(source.getSize()); destination.setName(source.getName()); destination.setValue(source.getValue()); }
From source file:gwtquery.plugins.enhance.client.gwt.TextBoxBaseWidgetFactory.java
License:Apache License
protected void copyAttributes(Element src, Element dest) { InputElement source = src.cast(); InputElement destination = dest.cast(); destination.setAccessKey(source.getAccessKey()); destination.setDefaultValue(source.getDefaultValue()); destination.setDisabled(source.isDisabled()); if (source.getMaxLength() > 0) destination.setMaxLength(source.getMaxLength()); destination.setReadOnly(source.isReadOnly()); destination.setSize(source.getSize()); destination.setName(source.getName()); destination.setValue(source.getValue()); }
From source file:org.datacleaner.monitor.shared.widgets.FileUploadFunctionHandler.java
License:Open Source License
public static void uploadFile(String fileUploadElementId) { final Element element = Document.get().getElementById(fileUploadElementId); final InputElement inputElement = getFileInput(element); if (inputElement == null) { throw new IllegalArgumentException("No file input found within element id: " + fileUploadElementId); }//from w w w . j a v a2s . co m GWT.log("Found file input element: " + inputElement); final String inputName = inputElement.getName(); final Element parent = inputElement.getParentElement(); parent.setInnerHTML("<div class='loader'></div>"); // use "contentType" param because form submission requires everything // to be text/html final String url = Urls.createRelativeUrl("util/upload?contentType=text/html"); final RootPanel rootPanel = RootPanel.get(); final FormPanel form = new FormPanel(); form.setVisible(false); form.setAction(url); form.setMethod(FormPanel.METHOD_POST); form.setEncoding(FormPanel.ENCODING_MULTIPART); form.getElement().appendChild(inputElement); form.addSubmitCompleteHandler(new SubmitCompleteHandler() { @Override public void onSubmitComplete(SubmitCompleteEvent event) { final String stringResponse = event.getResults(); GWT.log("File upload form submit complete! Results: " + stringResponse); try { final JSONValue jsonResponse = JSONParser.parseLenient(stringResponse); final JSONArray jsonFiles = jsonResponse.isObject().get("files").isArray(); final JSONValue jsonFile = jsonFiles.get(0); final String jsonFileStr = jsonFile.toString(); parent.setInnerHTML("<p>File uploaded!</p><input type='hidden' name='" + inputName + "' value='" + jsonFileStr + "' />"); rootPanel.remove(form); } catch (Exception e) { ErrorHandler.showErrorDialog("Unexpected error occurred", "An error occurred when uploading the file to the server.", stringResponse); } } }); rootPanel.add(form); GWT.log("Submitting hidden file upload form"); form.submit(); }
From source file:org.datacleaner.monitor.shared.widgets.FormWizardClientController.java
License:Open Source License
@Override public void requestNextPage(final AsyncCallback<WizardPage> callback) { final Map<String, List<String>> formParameters = new HashMap<String, List<String>>(); final FormElement formElement = FormElement.as(_form); final NodeCollection<com.google.gwt.dom.client.Element> inputElements = formElement.getElements(); for (int i = 0; i < inputElements.getLength(); i++) { final Element element = inputElements.getItem(i); final String name; final String value; final boolean included; final String tagName = element.getTagName(); if (tagName.equalsIgnoreCase("input")) { InputElement inputElement = InputElement.as(element); name = inputElement.getName(); value = inputElement.getValue(); String type = inputElement.getType(); if ("checkbox".equals(type) || "radio".equals(type)) { included = inputElement.isChecked(); } else { included = true;//from w w w . j a va2 s. c o m } } else { // useful for eg. <textarea> and <select> element types name = element.getPropertyString("name"); value = element.getPropertyString("value"); included = true; } if (included) { List<String> valueList = formParameters.get(name); if (valueList == null) { valueList = new ArrayList<String>(); formParameters.put(name, valueList); } valueList.add(value); } } _service.nextPage(_tenant, _wizardPage.getSessionIdentifier(), formParameters, callback); }
From source file:org.gwtbootstrap3.client.ui.InputToggleButtonGwt.java
License:Apache License
@Override public <T extends UIObject & HasName> void checkName(T button) { final String name = "name"; final Element label = button.getElement(); final InputElement input = InputElement.as(label.getFirstChildElement()); button.setName(name);/* w ww. j a v a 2 s.c om*/ assertEquals(name, button.getName()); assertEquals(name, input.getName()); }
From source file:org.opencms.ugc.client.CmsUgcWrapper.java
License:Open Source License
/** * Disables all file input fields except the one with the given name.<p> * * @param fieldNames the set of names of fields that should not be disabled *//* w ww.ja v a 2 s. c om*/ void disableAllFileFieldsExcept(Set<String> fieldNames) { for (InputElement field : getAllFields()) { if (isFileField(field)) { boolean shouldDisable = !fieldNames.contains(field.getName()); field.setDisabled(shouldDisable); } } }