Java Code Examples for org.apache.wicket.util.string.StringValue#toString()
The following examples show how to use
org.apache.wicket.util.string.StringValue#toString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConceptFeatureEditor.java From inception with Apache License 2.0 | 6 votes |
@Override public String[] getInputAsArray() { // If the web request includes the additional "identifier" parameter which is supposed // to contain the IRI of the selected item instead of its label, then we use that as the // value. WebRequest request = getWebRequest(); IRequestParameters requestParameters = request.getRequestParameters(); StringValue identifier = requestParameters .getParameterValue(getInputName() + ":identifier"); if (!identifier.isEmpty()) { return new String[] { identifier.toString() }; } return super.getInputAsArray(); }
Example 2
Source File: AjaxWlPage.java From yes-cart with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override protected void onBeforeRender() { executeHttpPostedCommands(); final StringValue skuValue = getPageParameters().get(ShoppingCartCommand.CMD_ADDTOWISHLIST); final String sku = skuValue.toString(); final StringBuilder outJson = new StringBuilder(); outJson.append("{ \"SKU\": \"").append(sku.replace("\"", "")).append("\" }"); addOrReplace(new Label("wlAddedObj", outJson.toString()).setEscapeModelStrings(false)); super.onBeforeRender(); persistCartIfNecessary(); }
Example 3
Source File: MenuConfig.java From projectforge-webapp with GNU General Public License v3.0 | 6 votes |
/** * @param id */ @SuppressWarnings("serial") public MenuConfig(final String id, final Menu menu, final FavoritesMenu favoritesMenu) { super(id); configureLink = new WebMarkupContainer("configureLink"); add(configureLink); configureBehavior = new AbstractDefaultAjaxBehavior() { @Override protected void respond(final AjaxRequestTarget target) { final Request request = RequestCycle.get().getRequest(); final StringValue configuration = request.getPostParameters().getParameterValue("configuration"); final String xml = configuration.toString(""); if (log.isDebugEnabled() == true) { log.debug(xml); } favoritesMenu.readFromXml(xml); favoritesMenu.storeAsUserPref(); } }; add(configureBehavior); add(new MenuConfigContent("content", menu)); }
Example 4
Source File: DocumentDetailsPage.java From inception with Apache License 2.0 | 5 votes |
public DocumentDetailsPage(PageParameters aParameters) { StringValue repositoryIdStringValue = aParameters.get(REPOSITORY_ID); StringValue collectionIdStringValue = aParameters.get(COLLECTION_ID); StringValue documentIdStringValue = aParameters.get(DOCUMENT_ID); if ( repositoryIdStringValue == null || documentIdStringValue == null || collectionIdStringValue == null ) { abort(); } repo = externalSearchService.getRepository(repositoryIdStringValue.toLong()); collectionId = collectionIdStringValue.toString(); documentId = documentIdStringValue.toString(); // Check access to project User currentUser = userRepository.getCurrentUser(); if (!projectService.isAnnotator(repo.getProject(), currentUser)) { abort(); } add(new Label("title", LoadableDetachableModel.of(this::getDocumentResult).map( r -> r.getDocumentTitle() != null ? r.getDocumentTitle() : r.getDocumentId()))); add(new Label("text", LoadableDetachableModel.of(this::getDocumentText))); }
Example 5
Source File: BasePage.java From openmeetings with Apache License 2.0 | 5 votes |
protected OmUrlFragment getUrlFragment(IRequestParameters params) { for (AreaKeys key : AreaKeys.values()) { StringValue type = params.getParameterValue(key.name()); if (!type.isEmpty()) { return new OmUrlFragment(key, type.toString()); } } return null; }
Example 6
Source File: WicketUtils.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
public static String getAsString(final PageParameters parameters, final String name) { final StringValue sval = parameters.get(name); if (sval == null || sval.isNull() == true) { return null; } else { return sval.toString(); } }
Example 7
Source File: BratAnnotationEditor.java From webanno with Apache License 2.0 | 4 votes |
private Object actionLookupNormData(AjaxRequestTarget aTarget, IRequestParameters request, VID paramId) throws AnnotationException, IOException { NormDataResponse response = new NormDataResponse(); // We interpret the databaseParam as the feature which we need to look up the feature // support StringValue databaseParam = request.getParameterValue("database"); // We interpret the key as the feature value or as a kind of query to be handled by the // feature support StringValue keyParam = request.getParameterValue("key"); StringValue layerParam = request.getParameterValue(PARAM_SPAN_TYPE); if (layerParam.isEmpty() || keyParam.isEmpty() || databaseParam.isEmpty()) { return response; } String database = databaseParam.toString(); long layerId = decodeTypeName(layerParam.toString()); AnnotatorState state = getModelObject(); AnnotationLayer layer = annotationService.getLayer(state.getProject(), layerId) .orElseThrow(() -> new AnnotationException("Layer with ID [" + layerId + "] does not exist in project [" + state.getProject().getName() + "](" + state.getProject().getId() + ")")); AnnotationFeature feature = annotationService.getFeature(database, layer); // Check where the query needs to be routed: to an editor extension or to a feature support if (paramId.isSynthetic()) { String extensionId = paramId.getExtensionId(); response.setResults(extensionRegistry.getExtension(extensionId) .renderLazyDetails(state.getDocument(), state.getUser(), paramId, feature, keyParam.toString()).stream() .map(d -> new NormalizationQueryResult(d.getLabel(), d.getValue())) .collect(Collectors.toList())); return response; } try { response.setResults(featureSupportRegistry.findExtension(feature) .renderLazyDetails(feature, keyParam.toString()).stream() .map(d -> new NormalizationQueryResult(d.getLabel(), d.getValue())) .collect(Collectors.toList())); } catch (Exception e) { LOG.error("Unable to load data", e); error("Unable to load data: " + ExceptionUtils.getRootCauseMessage(e)); } return response; }
Example 8
Source File: PFAutoCompleteTextField.java From projectforge-webapp with GNU General Public License v3.0 | 4 votes |
/** * @see org.apache.wicket.Component#onInitialize() */ @Override protected void onInitialize() { super.onInitialize(); behavior = new PFAutoCompleteBehavior<T>(renderer, settings) { private static final long serialVersionUID = 1L; @Override protected List<T> getChoices(final String input) { return PFAutoCompleteTextField.this.getChoices(input); } @Override protected List<T> getFavorites() { return PFAutoCompleteTextField.this.getFavorites(); } @Override protected List<String> getRecentUserInputs() { return PFAutoCompleteTextField.this.getRecentUserInputs(); } @Override protected String formatValue(final T value) { return PFAutoCompleteTextField.this.formatValue(value); } @Override protected String formatLabel(final T value) { return PFAutoCompleteTextField.this.formatLabel(value); } }; add(behavior); deleteBehavior = new AbstractDefaultAjaxBehavior() { private static final long serialVersionUID = 3014042180471042845L; @Override protected void respond(final AjaxRequestTarget target) { // Gather query params ?...&content=kssel final StringValue contentValue = RequestCycle.get().getRequest().getQueryParameters().getParameterValue(CONTENT); if (contentValue != null) { final String contentString = contentValue.toString(); if (getForm() instanceof AutoCompleteIgnoreForm) { ((AutoCompleteIgnoreForm) getForm()).ignore(PFAutoCompleteTextField.this, contentString); } // else { just ignore } } } }; add(deleteBehavior); }
Example 9
Source File: ChartRendererPanel.java From nextreports-server with Apache License 2.0 | 4 votes |
@Override protected void respond(AjaxRequestTarget target) { String param = getRequest().getRequestParameters().getParameterValue(PARAM).toString(); StringValue widgetIdString = getRequest().getRequestParameters().getParameterValue("id"); if (widgetIdString != null) { String widgetId = widgetIdString.toString(); if (widgetId != null) { // for iframe we get widget id from url!!! try { Widget loadWidget = dashboardService.getWidgetById(widgetId); if (loadWidget instanceof ChartWidget) { widget = (ChartWidget)loadWidget; } else if (loadWidget instanceof DrillDownWidget) { Entity entity = ((DrillDownWidget)loadWidget).getEntity(); if (entity instanceof Chart) { model = new Model<Chart>((Chart)entity); } } } catch (NotFoundException e) { LOG.error(e.getMessage(), e); } } } // behavior is called on any refresh, we have to call it only once // (otherwise the panel will be replaced in the same time the old one is refreshed) boolean isHTML5 = true; if (isHTML5String.isEmpty()) { isHTML5String = param; isHTML5 = Boolean.parseBoolean(param); } final ChartModel chartModel = new ChartModel(model, widget, isHTML5); // TODO put width, height in settings if (isHTML5) { if (zoom) { ChartHTML5Panel hp = new ChartHTML5Panel("chart", "100%", "100%", chartModel); //hp.setDetachedPage(true); container.replace(hp); } else { if ((width == null) || (height == null)) { width = "100%"; height = "300"; } container.replace(new ChartHTML5Panel("chart", width, height, chartModel)); } } else { if (zoom) { OpenFlashChart ofc = new OpenFlashChart("chart", "100%", "100%", chartModel); ofc.setDetachedPage(true); container.replace(ofc); } else { if ((width == null) || (height == null)) { width = "100%"; height = "300"; } container.replace(new OpenFlashChart("chart", width, height, chartModel)); } } target.add(container); error.replace(new Label("error", new Model<String>()) { private static final long serialVersionUID = 1L; @Override protected void onInitialize() { super.onInitialize(); if (chartModel.getObject() == null) { if (chartModel.getError() instanceof NoDataFoundException) { setDefaultModelObject(getString("ActionContributor.Run.nodata")); } else { setDefaultModelObject(ExceptionUtils.getRootCauseMessage(chartModel.getError())); } error.add(AttributeAppender.replace("class", "noChartData")); container.setVisible(false); } } @Override public boolean isVisible() { return chartModel.hasError(); } }); target.add(error); }
Example 10
Source File: BasePage.java From sakai with Educational Community License v2.0 | 2 votes |
/** * Parse a param * * @param parameters * @param name * @return */ static String getParamValue(final PageParameters parameters, final String name) { final StringValue value = parameters.get(name); return (value != null) ? value.toString() : null; }
Example 11
Source File: BasePage.java From sakai with Educational Community License v2.0 | 2 votes |
/** * Parse a param * * @param parameters * @param name * @return */ static String getParamValue(final PageParameters parameters, final String name) { final StringValue value = parameters.get(name); return (value != null) ? value.toString() : null; }