List of usage examples for org.apache.wicket.util.string StringValue valueOf
public static StringValue valueOf(final AppendingStringBuffer buffer)
From source file:org.efaps.ui.wicket.components.date.DateTimePanel.java
License:Apache License
/** * Method to get for the parameters returned from the form as a valid string. for a datetime * * @param _date date//from ww w .ja v a2 s. c o m * @param _hour hour * @param _minute minutes * @param _ampm am/pm * @return valid string * @throws EFapsException on error */ public List<StringValue> getDateAsString(final List<StringValue> _date, final List<StringValue> _hour, final List<StringValue> _minute, final List<StringValue> _ampm) throws EFapsException { final List<StringValue> ret = new ArrayList<>(); final List<DateTime> dates = getDateList(_date, _hour, _minute, _ampm); for (final DateTime date : dates) { final DateTimeFormatter isofmt = ISODateTimeFormat.dateTime(); ret.add(StringValue.valueOf(date.toString(isofmt))); } return ret; }
From source file:org.efaps.ui.wicket.components.FormContainer.java
License:Apache License
@Override public void process(final IFormSubmitter _submittingComponent) { // if their is a GridXComponent convert the ids to oids visitChildren(GridXComponent.class, new IVisitor<GridXComponent, Void>() { @Override/* www . ja v a 2 s.c om*/ public void component(final GridXComponent _gridX, final IVisit<Void> _visit) { try { final EFapsRequestParametersAdapter parameters = (EFapsRequestParametersAdapter) getRequest() .getRequestParameters(); final List<StringValue> selectedRows = parameters.getParameterValues("selectedRow"); if (CollectionUtils.isNotEmpty(selectedRows)) { final List<StringValue> newValues = new ArrayList<>(); for (final StringValue value : selectedRows) { final UIGrid uiGrid = (UIGrid) _gridX.getDefaultModelObject(); final Row row = uiGrid.getValues().get(value.toInt()); newValues.add(StringValue.valueOf(row.getInstance().getOid())); } parameters.setParameterValues("selectedRow", newValues); } } catch (StringValueConversionException | EFapsException e) { FormContainer.LOG.error("Catched exeption", e); } } }); // for a dropdown add the previous value as a parameter if (_submittingComponent instanceof AjaxFormSubmitter && ((AjaxFormSubmitter) _submittingComponent).getFormSubmittingComponent() != null && ((AjaxFormSubmitter) _submittingComponent) .getFormSubmittingComponent() instanceof DropDownField) { final Object object = ((DropDownField) ((AjaxFormSubmitter) _submittingComponent) .getFormSubmittingComponent()).getDefaultModelObject(); if (object instanceof DropDownOption) { final String key = ((DropDownField) ((AjaxFormSubmitter) _submittingComponent) .getFormSubmittingComponent()).getInputName(); ((EFapsRequestParametersAdapter) ((EFapsRequest) RequestCycle.get().getRequest()) .getRequestParameters()).addParameterValue(key + "_eFapsPrevious", ((DropDownOption) object).getValue()); } } super.process(_submittingComponent); // it must be ensured that the counter for sets is rested or we have big problems resetSetCounter(); }
From source file:org.efaps.ui.wicket.request.EFapsRequestParametersAdapter.java
License:Apache License
/** * Returns single value for parameter with specified name. This method always returns non-null * result even if the parameter does not exist. * * @param _name parameter name//from www. ja v a 2 s.c om * @return {@link StringValue} wrapping the actual value */ @Override public StringValue getParameterValue(final String _name) { final List<StringValue> values = this.parameters.get(_name); return (values != null && !values.isEmpty()) ? values.get(0) : StringValue.valueOf((String) null); }
From source file:org.efaps.ui.wicket.request.EFapsRequestParametersAdapter.java
License:Apache License
/** * Sets value for given key./* ww w .j a v a 2 s . c o m*/ * * @param _key key for the value * @param _value value */ public void setParameterValue(final String _key, final String _value) { final List<StringValue> list = new ArrayList<StringValue>(1); list.add(StringValue.valueOf(_value)); setParameterValues(_key, list); }
From source file:org.efaps.ui.wicket.request.EFapsRequestParametersAdapter.java
License:Apache License
/** * Adds a value for given key.//w w w . j a v a2 s .c om * * @param _key key for the value * @param _value value */ public void addParameterValue(final String _key, final String _value) { List<StringValue> list = this.parameters.get(_key); if (list == null) { list = new ArrayList<StringValue>(1); this.parameters.put(_key, list); } list.add(StringValue.valueOf(_value)); try { Context.getThreadContext().getParameters().put(_key, ParameterUtil.stringValues2Array(list)); } catch (final EFapsException e) { EFapsRequestParametersAdapter.LOG.error("Could not add parameter '{}' in Context.", _key); } }
From source file:org.hippoecm.frontend.model.map.AbstractValueMap.java
License:Apache License
/** * @see IValueMap#getStringValue(String) */ public StringValue getStringValue(String key) { return StringValue.valueOf(getString(key)); }
From source file:org.hippoecm.frontend.plugin.config.impl.JcrPluginConfig.java
License:Apache License
@Override public StringValue getStringValue(String key) { return StringValue.valueOf(getString(key)); }
From source file:org.hippoecm.frontend.plugin.config.impl.JcrPluginConfig.java
License:Apache License
@Override public Duration getDuration(String key) throws StringValueConversionException { return StringValue.valueOf(getKey(key)).toDuration(); }
From source file:org.hippoecm.frontend.plugin.config.impl.JcrPluginConfig.java
License:Apache License
@Override public Time getTime(String key) throws StringValueConversionException { return StringValue.valueOf(getKey(key)).toTime(); }
From source file:org.hippoecm.frontend.translation.components.folder.FolderTranslationPage.java
License:Apache License
public FolderTranslationPage(PageParameters parameters) { StringValue folderValue = parameters.get("folder"); if (folderValue.isNull()) { folderValue = StringValue.valueOf("evenements"); }// w ww .j a v a2s . c o m LoadableDetachableModel<T9Tree> treeModel = new LoadableDetachableModel<T9Tree>() { private static final long serialVersionUID = 1L; @Override protected T9Tree load() { return new JsonT9Tree(); } }; IModel<T9Node> t9NodeModel = new Model<T9Node>(treeModel.getObject().getNode(folderValue.toString())); add(new FolderTranslationView("grid", treeModel, t9NodeModel, new TestLocaleProvider())); }