List of usage examples for com.google.gwt.user.client.ui Hidden getValue
public String getValue()
From source file:com.eduworks.russel.ui.client.pagebuilder.screen.EPSSEditScreen.java
License:Apache License
/** * addAssetTrigger Adds the currently active asset to the project section and changes the Update button to unsaved state *///from w ww.ja va2s. c om public static void addAssetTrigger() { Hidden activeAssetFilename = ((Hidden) PageAssembler.elementToWidget("epssActiveAddAsset", PageAssembler.HIDDEN)); activeAssetId = activeAssetFilename.getValue().substring(0, activeAssetFilename.getValue().indexOf(",")); activeFilename = activeAssetFilename.getValue().substring(activeAssetFilename.getValue().indexOf(",") + 1); if (!isAssetInSection0()) pfmNow.addAsset(activeSection, activeAssetId, activeFilename, ""); else { pfmNow.addAsset(activeSection, activeAssetId, activeFilename, getAssetNotesInSection0()); ((TextBox) PageAssembler.elementToWidget("inputDevNotes", PageAssembler.TEXT)) .setText(getAssetNotesInSection0()); } DOM.getElementById(activeSectionId).removeClassName("empty"); }
From source file:com.eduworks.russel.ui.client.pagebuilder.screen.EPSSEditScreen.java
License:Apache License
/** * fillSectionNotes0 Retrieves section notes and search terms * @param elementId String/*from w w w . j av a 2 s .co m*/ * @param sectionIndex int */ private void fillSectionNotes0(final String elementId, final int sectionIndex) { ((TextBox) PageAssembler.elementToWidget("inputSectionNotes", PageAssembler.TEXT)).setText(""); ((TextBox) PageAssembler.elementToWidget("inputDevNotes", PageAssembler.TEXT)).setText(""); String sectionPanel = "epssCurrentSection"; Element currentSection = DOM.getElementById(sectionPanel); searchTerms = new Vector<String>(); int elementCount = currentSection.getChildCount(); for (int elementIndex = 0; elementIndex < elementCount; elementIndex++) currentSection.getChild(0).removeFromParent(); mergeSection0(currentSection, (Element) new HTML(templates().getEPSSEditSectionWidgets().getText()).getElement()); activeSection = DOM.getElementById(elementId).getInnerText(); activeSectionId = elementId; PageAssembler.attachHandler("inputSectionNotes", Event.ONCHANGE, new EventCallback() { @Override public void onEvent(Event event) { pfmNow.addSectionNotes(activeSection, cleanString0( ((TextBox) PageAssembler.elementToWidget("inputSectionNotes", PageAssembler.TEXT)) .getText())); DOM.getElementById("epssUpdate").removeClassName("white"); DOM.getElementById("epssUpdate").addClassName("blue"); DOM.getElementById("r-save-alert").removeClassName("hide"); DOM.getElementById(elementId).removeClassName("empty"); } }); PageAssembler.attachHandler("inputDevNotes", Event.ONCHANGE, new EventCallback() { @Override public void onEvent(Event event) { Hidden activeAssetFilename = ((Hidden) PageAssembler.elementToWidget("epssActiveAddAsset", PageAssembler.HIDDEN)); activeAssetId = activeAssetFilename.getValue().substring(0, activeAssetFilename.getValue().indexOf(",")); activeFilename = activeAssetFilename.getValue() .substring(activeAssetFilename.getValue().indexOf(",") + 1); pfmNow.addAsset(activeSection, activeAssetId, activeFilename, cleanString0( ((TextBox) PageAssembler.elementToWidget("inputDevNotes", PageAssembler.TEXT)).getText())); DOM.getElementById("epssUpdate").removeClassName("white"); DOM.getElementById("epssUpdate").addClassName("blue"); DOM.getElementById("r-save-alert").removeClassName("hide"); DOM.getElementById(elementId).removeClassName("empty"); } }); Element searchArea = DOM.getElementById("searchTerms"); int termCount = searchArea.getChildCount(); for (int termIndex = 0; termIndex < termCount; termIndex++) searchArea.removeChild(searchArea.getChild(0)); String[] searchTerms = new ESBPacket(pfmNow.projectSections.get(sectionIndex).isObject()) .getString(ProjectRecord.TEMPLATE_SECTION_TERMS).split(", "); for (int termsIndex = 0; termsIndex < searchTerms.length; termsIndex++) PageAssembler.merge("searchTerms", "x", (Element) new HTML("<a id=\"epssTerm" + (termsIndex + 1) + "\" class=\"searchTerm small white button finger\">" + searchTerms[termsIndex] + "</a>").getElement().getChild(0)); DOM.getElementById("helptext-asset") .setInnerText(new ESBPacket(pfmNow.projectSections.get(sectionIndex).isObject()) .getString(ProjectRecord.TEMPLATE_SECTION_GUIDENCE)); for (int termIndex = 1; termIndex <= searchTerms.length; termIndex++) { final int lockedTermIndex = termIndex; PageAssembler.attachHandler("epssTerm" + lockedTermIndex, Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { toggleSearchTerms0("epssTerm" + lockedTermIndex, ((Anchor) PageAssembler.elementToWidget("epssTerm" + lockedTermIndex, PageAssembler.A)) .getText()); } }); } if (pfmNow.projectSectionNotes != null) ((TextBox) PageAssembler.elementToWidget("inputSectionNotes", PageAssembler.TEXT)) .setText(pfmNow.projectSectionNotes.getSectionNotes(activeSection)); if (pfmNow.projectSectionAssets != null) { Vector<RUSSELFileRecord> assets = pfmNow.projectSectionAssets.getSectionAssets(activeSection); for (int x = 0; x < assets.size(); x++) { buildAssetTile0(sectionPanel, assets.get(x).getGuid(), assets.get(x).getFilename()); } PageAssembler.runCustomJSHooks(); } }
From source file:com.epam.feel.client.ui.util.gwtupload.FixedSingleUploader.java
License:Apache License
@Override protected void onFinishUpload() { super.onFinishUpload(); if (getStatus() == Status.REPEATED) { getStatusWidget().setError(getI18NConstants().uploaderAlreadyDone()); }//from ww w .ja va 2 s. c om getStatusWidget().setStatus(Status.UNINITIALIZED); reuse(); assignNewNameToFileInput(); for (Widget i : formWidgets) { if (i instanceof Hidden) { Hidden h = (Hidden) i; if (h.getValue().startsWith(fileInputPrefix)) { h.setValue(getInputName()); } } } getFileInput().getWidget().setVisible(true); if (button != null) { setEnabledButton(true); button.removeStyleName("changed"); if (!autoSubmit) { button.setVisible(true); } } if (autoSubmit) { getFileInput().setText(i18nStrs.uploaderBrowse()); } }
From source file:com.xpn.xwiki.wysiwyg.client.widget.HiddenConfig.java
License:Open Source License
/** * {@inheritDoc}//from w ww . ja v a 2 s . co m * * @see Config#getParameter(String, String) */ public String getParameter(String paramName, String defaultValue) { Hidden hidden = params.get(paramName); return hidden == null ? defaultValue : hidden.getValue(); }
From source file:com.xpn.xwiki.wysiwyg.client.widget.HiddenConfig.java
License:Open Source License
/** * Sets the value of the specified parameter. If the parameter doesn't exists it is added. * /*from ww w . j ava 2 s .co m*/ * @param paramName The name of the parameter. * @param paramValue The value of the parameter. * @return The previous value of the given parameter, or null if this parameter is new. */ public String setParameter(String paramName, String paramValue) { Hidden hidden = params.get(paramName); if (hidden != null) { String previousValue = hidden.getValue(); hidden.setValue(paramValue); return previousValue; } else { hidden = new Hidden(getQualifiedName(paramName), paramValue); params.put(paramName, hidden); container.add(hidden); return null; } }
From source file:gwtupload.client.ResumableUploader.java
License:Apache License
@Override protected void onFinishUpload() { super.onFinishUpload(); if (getStatus() == Status.REPEATED) { getStatusWidget().setError(getI18NConstants().uploaderAlreadyDone()); }//from ww w.j a v a 2 s . c om getStatusWidget().setStatus(Status.UNINITIALIZED); reuse(); assignNewNameToFileInput(); for (Widget i : formWidgets) { if (i instanceof Hidden) { Hidden h = (Hidden) i; if (h.getValue().startsWith(fileInputPrefix)) { h.setValue(getInputName()); } } } getFileInput().asWidget().setVisible(true); if (button != null) { setEnabledButton(true); button.removeStyleName("changed"); if (!autoSubmit) { button.setVisible(true); } } if (autoSubmit) { getFileInput().setText(i18nStrs.uploaderBrowse()); } }
From source file:org.bonitasoft.forms.client.view.widget.FormFieldWidget.java
License:Open Source License
/** * Retrieve the value of the field under the form of a {@link FormFieldValue} object. This conversion is needed because RPC * calls do not support the type 'Object'. * * @return a {@link FormFieldValue} object *///from w w w. j av a2s.co m @SuppressWarnings("unchecked") public FormFieldValue getValue() { long attachmentId = -1; String attachmentName = null; Serializable value = null; String valueType = null; String format = null; String displayedValue = null; switch (widgetType) { case TEXTBOX: final TextBox textBox = (TextBox) fieldWidget; value = textBox.getValue(); valueType = SupportedFieldTypes.JAVA_STRING_CLASSNAME; break; case TEXTAREA: final TextArea textArea = (TextArea) fieldWidget; value = textArea.getValue(); valueType = SupportedFieldTypes.JAVA_STRING_CLASSNAME; break; case TEXT: final HTML text = (HTML) fieldWidget; value = text.getHTML(); valueType = SupportedFieldTypes.JAVA_STRING_CLASSNAME; break; case RICH_TEXTAREA: final RichTextWidget richTextWidget = (RichTextWidget) fieldWidget; value = richTextWidget.getValue(); valueType = SupportedFieldTypes.JAVA_STRING_CLASSNAME; break; case PASSWORD: final PasswordTextBox passwordTextBox = (PasswordTextBox) fieldWidget; value = passwordTextBox.getValue(); valueType = SupportedFieldTypes.JAVA_STRING_CLASSNAME; break; case CHECKBOX: final CheckBox checkBox = (CheckBox) fieldWidget; value = checkBox.getValue(); valueType = SupportedFieldTypes.JAVA_BOOLEAN_CLASSNAME; break; case RADIOBUTTON_GROUP: final RadioButtonGroupWidget radioButtonGroupWidget = (RadioButtonGroupWidget) fieldWidget; value = radioButtonGroupWidget.getValue(); valueType = SupportedFieldTypes.JAVA_STRING_CLASSNAME; break; case LISTBOX_SIMPLE: final ListBox listBox = (ListBox) fieldWidget; final int index = listBox.getSelectedIndex(); if (index > -1) { value = listBox.getValue(index); } valueType = SupportedFieldTypes.JAVA_STRING_CLASSNAME; break; case LISTBOX_MULTIPLE: value = new ArrayList<String>(); final ListBox listBoxMulti = (ListBox) fieldWidget; for (int i = 0; i < listBoxMulti.getItemCount(); i++) { if (listBoxMulti.isItemSelected(i)) { ((List<String>) value).add(listBoxMulti.getValue(i)); } } valueType = SupportedFieldTypes.JAVA_COLLECTION_CLASSNAME; break; case SUGGESTBOX: final SuggestBox suggestBox = (SuggestBox) fieldWidget; displayedValue = suggestBox.getValue(); value = suggestionsMap.get(displayedValue); if (value == null) { value = displayedValue; } valueType = SupportedFieldTypes.JAVA_STRING_CLASSNAME; break; case SUGGESTBOX_ASYNC: final AsyncSuggestBoxWidget formAsyncSuggestBoxWidget = (AsyncSuggestBoxWidget) fieldWidget; value = formAsyncSuggestBoxWidget.getValue(); valueType = SupportedFieldTypes.JAVA_STRING_CLASSNAME; break; case CHECKBOX_GROUP: value = new ArrayList<String>(); final CheckboxGroupWidget checkboxGroupWidget = (CheckboxGroupWidget) fieldWidget; for (final String checkboxGroupValue : checkboxGroupWidget.getValue()) { ((List<String>) value).add(checkboxGroupValue); } valueType = SupportedFieldTypes.JAVA_COLLECTION_CLASSNAME; break; case DATE: final DateBox dateBox = (DateBox) fieldWidget; final String strValue = dateBox.getTextBox().getValue(); final Date dtValue = dateBox.getValue(); if (strValue != null && strValue.length() > 0 && dtValue == null) { value = strValue; valueType = SupportedFieldTypes.JAVA_STRING_CLASSNAME; } else { value = dtValue; valueType = SupportedFieldTypes.JAVA_DATE_CLASSNAME; } break; case DURATION: final DurationWidget duration = (DurationWidget) fieldWidget; value = duration.getValue(); valueType = SupportedFieldTypes.JAVA_LONG_CLASSNAME; break; case FILEUPLOAD: final FileUploadWidget fileUpload = (FileUploadWidget) fieldWidget; attachmentName = fileUpload.getAttachmentName(); attachmentId = fileUpload.getAttachmentId(); value = fileUpload.getValue(); displayedValue = fileUpload.getDisplayedValue(); valueType = fileUpload.getValueType(); break; case TABLE: final TableWidget table = (TableWidget) fieldWidget; value = (Serializable) table.getValue(); valueType = SupportedFieldTypes.JAVA_COLLECTION_CLASSNAME; break; case EDITABLE_GRID: final EditableGridWidget grid = (EditableGridWidget) fieldWidget; value = (Serializable) grid.getValue(); valueType = SupportedFieldTypes.JAVA_COLLECTION_CLASSNAME; break; case HIDDEN: final Hidden hidden = (Hidden) fieldWidget; value = hidden.getValue(); valueType = SupportedFieldTypes.JAVA_STRING_CLASSNAME; break; default: break; } if (displayFormat != null) { format = displayFormat.getPattern(); } else { format = DateTimeFormat.getFormat(PredefinedFormat.DATE_LONG).getPattern(); } final FormFieldValue formFieldValue = new FormFieldValue(value, valueType, format, fieldOutputType); if (WidgetType.FILEUPLOAD.equals(widgetType)) { formFieldValue.setDocumentName(attachmentName); formFieldValue.setDocumentId(attachmentId); formFieldValue.setDisplayedValue(displayedValue); formFieldValue.setDocument(true); } return formFieldValue; }
From source file:org.bonitasoft.forms.client.view.widget.FormFieldWidget.java
License:Open Source License
/** * Set the value of the widget// w w w.ja va2s .c o m * * @param fieldValue */ public void setValue(final FormFieldValue fieldValue) { if (fieldValue.getValue() != null) { Collection<String> values = null; boolean fireEvents = true; switch (widgetType) { case TEXTBOX: final TextBox textBox = (TextBox) fieldWidget; if (SupportedFieldTypes.JAVA_DATE_CLASSNAME.equals(fieldValue.getValueType())) { textBox.setValue(getDateAsText(fieldValue), fireEvents); } else { textBox.setValue(getStringValue(fieldValue), fireEvents); } break; case TEXTAREA: final TextArea textArea = (TextArea) fieldWidget; if (SupportedFieldTypes.JAVA_DATE_CLASSNAME.equals(fieldValue.getValueType())) { textArea.setValue(getDateAsText(fieldValue), fireEvents); } else { textArea.setValue(getStringValue(fieldValue), fireEvents); } break; case RICH_TEXTAREA: final RichTextWidget richTextWidget = (RichTextWidget) fieldWidget; if (SupportedFieldTypes.JAVA_DATE_CLASSNAME.equals(fieldValue.getValueType())) { richTextWidget.setValue(getDateAsText(fieldValue)); } else { richTextWidget.setValue(getStringValue(fieldValue)); } break; case TEXT: final HTML text = (HTML) fieldWidget; if (text.getHTML() != null && text.getHTML().equals(fieldValue.getValue()) || fieldValue.getValue() != null && fieldValue.getValue().equals(text.getHTML())) { fireEvents = false; } if (SupportedFieldTypes.JAVA_DATE_CLASSNAME.equals(fieldValue.getValueType())) { text.setText(getDateAsText(fieldValue)); } else { text.setHTML(getStringValue(fieldValue)); } if (fireEvents) { DomEvent.fireNativeEvent(Document.get().createChangeEvent(), text); } break; case PASSWORD: final PasswordTextBox passwordTextBox = (PasswordTextBox) fieldWidget; passwordTextBox.setValue(getStringValue(fieldValue), fireEvents); break; case CHECKBOX: final CheckBox checkBox = (CheckBox) fieldWidget; try { checkBox.setValue((Boolean) fieldValue.getValue(), fireEvents); } catch (final Exception e) { checkBox.setValue(false, fireEvents); Window.alert("initial value for checkbox " + widgetId + " should be a Boolean."); } break; case RADIOBUTTON_GROUP: final RadioButtonGroupWidget radioButtonGroupWidget = (RadioButtonGroupWidget) fieldWidget; radioButtonGroupWidget.setValue(getStringValue(fieldValue), fireEvents); break; case LISTBOX_SIMPLE: final ListBox listBox = (ListBox) fieldWidget; final int index = listBox.getSelectedIndex(); if (index < 0) { fireEvents = false; } else { if (listBox.getValue(index).equals(getStringValue(fieldValue))) { fireEvents = false; } } for (int i = 0; i < listBox.getItemCount(); i++) { if (listBox.getItemText(i).equals(getStringValue(fieldValue))) { listBox.setItemSelected(i, true); break; } } if (fireEvents) { DomEvent.fireNativeEvent(Document.get().createChangeEvent(), listBox); } break; case LISTBOX_MULTIPLE: final ListBox listBoxMulti = (ListBox) fieldWidget; values = getStringValues(fieldValue); boolean valueChanged = false; for (int i = 0; i < listBoxMulti.getItemCount(); i++) { if (values != null && values.contains(listBoxMulti.getItemText(i))) { if (!listBoxMulti.isItemSelected(i)) { valueChanged = true; listBoxMulti.setItemSelected(i, true); } } else { if (listBoxMulti.isItemSelected(i)) { valueChanged = true; listBoxMulti.setItemSelected(i, false); } } } if (fireEvents && valueChanged) { DomEvent.fireNativeEvent(Document.get().createChangeEvent(), listBoxMulti); } break; case SUGGESTBOX: final SuggestBox suggestBox = (SuggestBox) fieldWidget; final String stringValue = getStringValue(fieldValue); String labelValue = null; for (final Entry<String, String> suggestionEntry : suggestionsMap.entrySet()) { if (suggestionEntry.getValue() != null && suggestionEntry.getValue().equals(stringValue)) { labelValue = suggestionEntry.getKey(); } } if (labelValue != null) { suggestBox.setValue(labelValue, fireEvents); } else { suggestBox.setValue(stringValue, fireEvents); } break; case SUGGESTBOX_ASYNC: final AsyncSuggestBoxWidget formAsyncSuggestBoxWidget = (AsyncSuggestBoxWidget) fieldWidget; formAsyncSuggestBoxWidget.setValue(getStringValue(fieldValue), fireEvents); break; case CHECKBOX_GROUP: final CheckboxGroupWidget checkboxGroupWidget = (CheckboxGroupWidget) fieldWidget; values = getStringValues(fieldValue); checkboxGroupWidget.setValue(values, fireEvents); break; case DATE: final DateBox dateBox = (DateBox) fieldWidget; try { dateBox.setValue((Date) fieldValue.getValue(), fireEvents); } catch (final Exception e) { dateBox.setValue(null, fireEvents); Window.alert("initial value for date " + widgetId + " should be a Date."); } break; case DURATION: final DurationWidget durationWidget = (DurationWidget) fieldWidget; Long duration = null; try { duration = (Long) fieldValue.getValue(); } catch (final Exception e) { duration = 0L; Window.alert("The initial value for duration widget " + widgetId + " should be a Long."); } durationWidget.setValue(duration, fireEvents); break; case IMAGE: final ImageWidget image = (ImageWidget) fieldWidget; image.setValue(fieldValue.getDocumentId(), getStringValue(fieldValue), fireEvents); break; case TABLE: final TableWidget table = (TableWidget) fieldWidget; table.setValue(getTableValue(fieldValue), fireEvents); if (fireEvents) { DomEvent.fireNativeEvent(Document.get().createChangeEvent(), table); } break; case EDITABLE_GRID: final EditableGridWidget grid = (EditableGridWidget) fieldWidget; grid.setValue(getGridValue(fieldValue)); if (fireEvents) { DomEvent.fireNativeEvent(Document.get().createChangeEvent(), grid); } break; case HIDDEN: final Hidden hidden = (Hidden) fieldWidget; if (hidden.getValue() != null && hidden.getValue().equals(fieldValue.getValue()) || fieldValue.getValue() != null && fieldValue.getValue().equals(hidden.getValue())) { fireEvents = false; } hidden.setValue(getStringValue(fieldValue)); if (fireEvents) { DomEvent.fireNativeEvent(Document.get().createChangeEvent(), hidden); } break; default: Window.alert("The modification of the value of a " + widgetType + " widget is not supported."); break; } } }
From source file:org.glimpse.client.Aggregator.java
License:Open Source License
public static String getHiddenValue(String id) { Element elm = DOM.getElementById(id); if (elm == null) { return null; }//www. j av a 2 s .c o m final Hidden hidden = Hidden.wrap(elm); return (hidden != null) ? hidden.getValue() : null; }
From source file:org.unitime.timetable.gwt.client.widgets.CourseNumbersSuggestBox.java
License:Apache License
private String getConfiguration() { String conf = iConfiguration; for (MatchResult matcher = iRegExp.exec(conf); matcher != null; matcher = iRegExp.exec(conf)) { Element element = DOM.getElementById(matcher.getGroup(1)); String value = ""; if ("select".equalsIgnoreCase(element.getTagName())) { ListBox list = ListBox.wrap(element); for (int i = 0; i < list.getItemCount(); i++) { if (list.isItemSelected(i)) value += (value.isEmpty() ? "" : ",") + list.getValue(i); }/*from w w w . ja va2 s . co m*/ } else if ("input".equalsIgnoreCase(element.getTagName())) { TextBox text = TextBox.wrap(element); value = text.getText(); } else { Hidden hidden = Hidden.wrap(element); value = hidden.getValue(); } conf = conf.replace("${" + matcher.getGroup(1) + "}", value); } return conf; }