List of usage examples for org.apache.wicket.request IRequestParameters getParameterValue
StringValue getParameterValue(String name);
From source file:com.userweave.module.methoden.iconunderstandability.page.survey.IconMatchingTestUI.java
License:Open Source License
private void addTermsView() { terms = getConfiguration().getTerms(); termsV = new ArrayList<ItmTerm>(); initTermsV();// w w w . j a v a 2s . c om RefreshingView rv; add(rv = new RefreshingView("term_content") { @Override protected Iterator getItemModels() { return new ModelIteratorAdapter(termsV.iterator()) { @Override protected IModel model(Object object) { return new CompoundPropertyModel(object); } }; } @Override protected void populateItem(Item item) { final String termValue = LocalizationUtils.getValue(getTermValue(item)); DropComponent dropComponent = new DropComponent("drop_component"); dropComponent.add(new AttributeAppender("style", new Model("width:" + Integer.toString(TILE_WIDTH + 4) + "px;"), " ")); dropComponent.add(new WebMarkupContainer("dropFieldCenter") { { add(new AttributeAppender("style", new Model("height:" + Integer.toString(TILE_HEIGHT - 13 - 6) + "px;"), " ")); } }); item.add(dropComponent); AbstractDefaultAjaxBehavior dropCallbackBehavior = new AbstractDefaultAjaxBehavior() { @Override protected void respond(AjaxRequestTarget target) { IRequestParameters parameters = RequestCycle.get().getRequest().getRequestParameters(); // ValueMap parameterMap = // new ValueMap(RequestCycle.get().getRequest().getParameterMap()); Iterator<String> i = parameters.getParameterNames().iterator(); boolean found = false; while (i.hasNext()) { if (i.next().equals(IMAGE_ID_PARAMETER)) { int imageIndex = parameters.getParameterValue(IMAGE_ID_PARAMETER).toInt(); if (imageIndex != -1) { ITMImage image = imagesV.get(imageIndex); String imageId = image.getId().toString(); matchingResult.put(termValue, imageId); } else { matchingResult.remove(termValue); } found = true; break; } } if (!found) { matchingResult.remove(termValue); } getSurveyStepTimer().setEndTimeNow(); } }; dropComponent.add(dropCallbackBehavior); String dropComponentId = createId(item.getIndex()); dropComponent.add(new AttributeModifier(DROP_COMPONENT_ID_PARAMETER, new Model(dropComponentId))); // um js-callbacks pro behaviour und dispatch anhand componentId zu erzeugen id2Behaviour.put(dropComponentId, dropCallbackBehavior); WebMarkupContainer wmc; item.add(wmc = new WebMarkupContainer("table_content") { { add(new AttributeAppender("style", new Model<String>("height:" + Integer.toString(TILE_HEIGHT - 2 - 6) + "px;"), " ")); } }); wmc.add(new Label("text", termValue)); item.add(new WebMarkupContainer("drop_end_center") { { add(new AttributeAppender("style", new Model<String>("height:" + Integer.toString(TILE_HEIGHT - 8 - 6) + "px;"), " ")); } }); } private LocalizedString getTermValue(Item item) { return ((ItmTerm) item.getModel().getObject()).getValue(); } }); }
From source file:com.vaynberg.wicket.select2.AbstractSelect2Choice.java
License:Apache License
@Override public void onResourceRequested() { // this is the callback that retrieves matching choices used to populate the dropdown Request request = getRequestCycle().getRequest(); IRequestParameters params = request.getRequestParameters(); // retrieve choices matching the search term String term = params.getParameterValue("term").toOptionalString(); int page = params.getParameterValue("page").toInt(1); // select2 uses 1-based paging, but in wicket world we are used to // 0-based/* w w w . j a v a 2 s . c o m*/ page -= 1; Response<T> response = new Response<T>(); provider.query(term, page, response); // jsonize and write out the choices to the response WebResponse webResponse = (WebResponse) getRequestCycle().getResponse(); webResponse.setContentType("application/json"); OutputStreamWriter out = new OutputStreamWriter(webResponse.getOutputStream(), getRequest().getCharset()); JSONWriter json = new JSONWriter(out); try { json.object(); json.key("results").array(); for (T item : response) { json.object(); provider.toJson(item, json); json.endObject(); } json.endArray(); json.key("more").value(response.getHasMore()).endObject(); } catch (JSONException e) { throw new RuntimeException("Could not write Json response", e); } try { out.flush(); } catch (IOException e) { throw new RuntimeException("Could not write Json to servlet response", e); } }
From source file:de.inren.service.picture.PictureResource.java
License:Apache License
private File getImageFile(IRequestParameters params) { log.info("injecting getImageFile"); Injector.get().inject(this); if (params.getParameterNames().contains(ID)) { final String digest = params.getParameterValue(ID).toString(); log.info("digest=" + digest); log.info("pictureModificationService=" + pictureModificationService); if (isThumbnail(params)) { return pictureModificationService.getThumbnailImage(digest); } else {//from w w w.j a va2 s.c o m if (isLayout(params)) { return pictureModificationService.getLayoutImage(digest); } else { return pictureModificationService.getImage(digest); } } } return null; }
From source file:de.tudarmstadt.ukp.clarin.webanno.brat.annotation.BratAnnotator.java
License:Apache License
public BratAnnotator(String id, IModel<BratAnnotatorModel> aModel, final AnnotationDetailEditorPanel aEditor) { super(id, aModel); this.editor = aEditor; // Allow AJAX updates. setOutputMarkupId(true);/*from w ww .ja va 2 s .c o m*/ // The annotator is invisible when no document has been selected. Make sure that we can // make it visible via AJAX once the document has been selected. setOutputMarkupPlaceholderTag(true); if (getModelObject().getDocument() != null) { collection = "#" + getModelObject().getProject().getName() + "/"; } vis = new WebMarkupContainer("vis"); vis.setOutputMarkupId(true); controller = new AbstractDefaultAjaxBehavior() { private static final long serialVersionUID = 1L; @Override protected void respond(AjaxRequestTarget aTarget) { final IRequestParameters request = getRequest().getPostParameters(); aTarget.addChildren(getPage(), FeedbackPanel.class); // Parse annotation ID if present in request VID paramId; if (!request.getParameterValue(PARAM_ID).isEmpty() && !request.getParameterValue(PARAM_ARC_ID).isEmpty()) { throw new IllegalStateException("[id] and [arcId] cannot be both set at the same time!"); } else if (!request.getParameterValue(PARAM_ID).isEmpty()) { paramId = VID.parseOptional(request.getParameterValue(PARAM_ID).toString()); } else { paramId = VID.parseOptional(request.getParameterValue(PARAM_ARC_ID).toString()); } // Ignore ghosts if (paramId.isGhost()) { error("This is a ghost annotation, select layer and feature to annotate."); return; } // Get action String action = request.getParameterValue(PARAM_ACTION).toString(); // Load the CAS if necessary boolean requiresCasLoading = action.equals(SpanAnnotationResponse.COMMAND) || action.equals(ArcAnnotationResponse.COMMAND) || action.equals(GetDocumentResponse.COMMAND); JCas jCas = null; if (requiresCasLoading) { // Make sure we load the CAS only once here in case of an annotation action. try { jCas = getCas(getModelObject()); } catch (ClassNotFoundException e) { error("Invalid reader: " + e.getMessage()); } catch (IOException e) { error(e.getMessage()); } catch (UIMAException e) { error(ExceptionUtils.getRootCauseMessage(e)); } } // HACK: If an arc was clicked that represents a link feature, then open the // associated span annotation instead. if (paramId.isSlotSet() && action.equals(ArcAnnotationResponse.COMMAND)) { action = SpanAnnotationResponse.COMMAND; paramId = new VID(paramId.getId()); } BratAjaxCasController controller = new BratAjaxCasController(repository, annotationService); // Doing anything but a span annotation when a slot is armed will unarm it if (getModelObject().isSlotArmed() && !action.equals(SpanAnnotationResponse.COMMAND)) { getModelObject().clearArmedSlot(); } Object result = null; try { LOG.info("AJAX-RPC CALLED: [" + action + "]"); if (action.equals(WhoamiResponse.COMMAND)) { result = controller.whoami(); } else if (action.equals(SpanAnnotationResponse.COMMAND)) { assert jCas != null; // do not annotate closed documents if (editor.isAnnotationFinished()) { error("This document is already closed. Please ask your project manager to re-open it via the Montoring page"); LOG.error( "This document is already closed. Please ask your project manager to re-open it via the Montoring page"); return; } if (getModelObject().isSlotArmed()) { if (paramId.isSet()) { // Fill slot with existing annotation editor.setSlot(aTarget, jCas, getModelObject(), paramId.getId()); } else if (!CAS.TYPE_NAME_ANNOTATION .equals(getModelObject().getArmedFeature().getType())) { // Fill slot with new annotation (only works if a concrete type is // set for the link feature! SpanAdapter adapter = (SpanAdapter) getAdapter(annotationService, annotationService.getLayer(getModelObject().getArmedFeature().getType(), getModelObject().getProject())); Offsets offsets = getSpanOffsets(request, jCas, paramId); try { int id = adapter.add(jCas, offsets.getBegin(), offsets.getEnd(), null, null); editor.setSlot(aTarget, jCas, getModelObject(), id); } catch (BratAnnotationException e) { error(ExceptionUtils.getRootCauseMessage(e)); LOG.error(ExceptionUtils.getRootCauseMessage(e), e); } } else { throw new BratAnnotationException( "Unable to create annotation of type [" + CAS.TYPE_NAME_ANNOTATION + "]. Please click an annotation in stead of selecting new text."); } } else { /*if (paramId.isSet()) { getModelObject().setForwardAnnotation(false); }*/ // Doing anything but filling an armed slot will unarm it editor.clearArmedSlotModel(); getModelObject().clearArmedSlot(); Selection selection = getModelObject().getSelection(); selection.setRelationAnno(false); Offsets offsets = getSpanOffsets(request, jCas, paramId); selection.setAnnotation(paramId); selection.set(jCas, offsets.getBegin(), offsets.getEnd()); bratRenderHighlight(aTarget, selection.getAnnotation()); editor.reloadLayer(aTarget); if (selection.getAnnotation().isNotSet()) { selection.setAnnotate(true); editor.actionAnnotate(aTarget, getModelObject(), false); } else { selection.setAnnotate(false); bratRender(aTarget, jCas); result = new SpanAnnotationResponse(); } } } else if (action.equals(ArcAnnotationResponse.COMMAND)) { assert jCas != null; // do not annotate closed documents if (editor.isAnnotationFinished()) { error("This document is already closed. Please ask your project manager to re-open it via the Montoring page"); LOG.error( "This document is already closed. Please ask your project manager to re-open it via the Montoring page"); return; } Selection selection = getModelObject().getSelection(); selection.setRelationAnno(true); selection.setAnnotation(paramId); selection.setOriginType(request.getParameterValue(PARAM_ORIGIN_TYPE).toString()); selection.setOrigin(request.getParameterValue(PARAM_ORIGIN_SPAN_ID).toInteger()); selection.setTargetType(request.getParameterValue(PARAM_TARGET_TYPE).toString()); selection.setTarget(request.getParameterValue(PARAM_TARGET_SPAN_ID).toInteger()); bratRenderHighlight(aTarget, getModelObject().getSelection().getAnnotation()); editor.reloadLayer(aTarget); if (getModelObject().getSelection().getAnnotation().isNotSet()) { selection.setAnnotate(true); editor.actionAnnotate(aTarget, getModelObject(), false); } else { selection.setAnnotate(false); bratRender(aTarget, jCas); result = new ArcAnnotationResponse(); } } else if (action.equals(LoadConfResponse.COMMAND)) { result = controller.loadConf(); } else if (action.equals(GetCollectionInformationResponse.COMMAND)) { if (getModelObject().getProject() != null) { result = controller.getCollectionInformation(getModelObject().getAnnotationLayers()); } else { result = new GetCollectionInformationResponse(); } } else if (action.equals(GetDocumentResponse.COMMAND)) { if (getModelObject().getProject() != null) { result = controller.getDocumentResponse(getModelObject(), 0, jCas, true); } else { result = new GetDocumentResponse(); } } LOG.info("AJAX-RPC DONE: [" + action + "]"); } catch (ClassNotFoundException e) { LOG.error("Invalid reader: " + e.getMessage(), e); error("Invalid reader: " + e.getMessage()); } catch (Exception e) { error("Unexpected error: " + e.getMessage()); LOG.error(ExceptionUtils.getRootCauseMessage(e)); } // Serialize updated document to JSON if (result == null) { LOG.warn("AJAX-RPC: Action [" + action + "] produced no result!"); } else { String json = toJson(result); // Since we cannot pass the JSON directly to Brat, we attach it to the HTML // element into which BRAT renders the SVG. In our modified ajax.js, we pick it // up from there and then pass it on to BRAT to do the rendering. aTarget.prependJavaScript("Wicket.$('" + vis.getMarkupId() + "').temp = " + json + ";"); } aTarget.addChildren(getPage(), FeedbackPanel.class); if (getModelObject().getSelection().getAnnotation().isNotSet()) { editor.setAnnotationLayers(getModelObject()); } editor.reload(aTarget); if (BratAnnotatorUtility.isDocumentFinished(repository, getModelObject())) { error("This document is already closed. Please ask your project " + "manager to re-open it via the Montoring page"); } } }; add(vis); add(controller); }
From source file:de.tudarmstadt.ukp.clarin.webanno.brat.annotation.BratAnnotator.java
License:Apache License
private Offsets getSpanOffsets(IRequestParameters request, JCas jCas, VID aVid) throws IOException { if (aVid.isNotSet()) { // Create new span annotation String offsets = request.getParameterValue(PARAM_OFFSETS).toString(); OffsetsList offsetLists = JSONUtil.getJsonConverter().getObjectMapper().readValue(offsets, OffsetsList.class); Sentence sentence = BratAjaxCasUtil.selectSentenceAt(jCas, getModelObject().getSentenceBeginOffset(), getModelObject().getSentenceEndOffset()); int annotationBegin = sentence.getBegin() + offsetLists.get(0).getBegin(); int annotationEnd = sentence.getBegin() + offsetLists.get(offsetLists.size() - 1).getEnd(); return new Offsets(annotationBegin, annotationEnd); } else {/* w w w . j av a 2 s.c o m*/ // Edit existing span annotation AnnotationFS fs = BratAjaxCasUtil.selectByAddr(jCas, aVid.getId()); return new Offsets(fs.getBegin(), fs.getEnd()); } }
From source file:de.tudarmstadt.ukp.clarin.webanno.brat.curation.component.SuggestionViewPanel.java
License:Apache License
public SuggestionViewPanel(String id, IModel<LinkedList<CurationUserSegmentForAnnotationDocument>> aModel) { super(id, aModel); // update list of brat embeddings sentenceListView = new ListView<CurationUserSegmentForAnnotationDocument>("sentenceListView", aModel) { private static final long serialVersionUID = -5389636445364196097L; @Override/*from w w w.j av a 2 s . c om*/ protected void populateItem(ListItem<CurationUserSegmentForAnnotationDocument> item2) { final CurationUserSegmentForAnnotationDocument curationUserSegment = item2.getModelObject(); BratSuggestionVisualizer curationVisualizer = new BratSuggestionVisualizer("sentence", new Model<CurationUserSegmentForAnnotationDocument>(curationUserSegment)) { private static final long serialVersionUID = -1205541428144070566L; /** * Method is called, if user has clicked on a span or an arc in the sentence * panel. The span or arc respectively is identified and copied to the merge * cas. * @throws IOException * @throws ClassNotFoundException * @throws UIMAException * @throws BratAnnotationException */ @Override protected void onSelectAnnotationForMerge(AjaxRequestTarget aTarget) throws UIMAException, ClassNotFoundException, IOException, BratAnnotationException { // TODO: chain the error from this component up in the // CurationPage // or CorrectionPage if (BratAnnotatorUtility.isDocumentFinished(repository, curationUserSegment.getBratAnnotatorModel())) { aTarget.appendJavaScript( "alert('This document is already closed." + " Please ask admin to re-open')"); return; } final IRequestParameters request = getRequest().getPostParameters(); String username = SecurityContextHolder.getContext().getAuthentication().getName(); User user = userRepository.get(username); SourceDocument sourceDocument = curationUserSegment.getBratAnnotatorModel().getDocument(); JCas annotationJCas = null; annotationJCas = (curationUserSegment.getBratAnnotatorModel().getMode() .equals(Mode.AUTOMATION) || curationUserSegment.getBratAnnotatorModel().getMode().equals(Mode.CORRECTION)) ? repository.readAnnotationCas( repository.getAnnotationDocument(sourceDocument, user)) : repository.readCurationCas(sourceDocument); StringValue action = request.getParameterValue("action"); // check if clicked on a span if (!action.isEmpty() && action.toString().equals("selectSpanForMerge")) { mergeSpan(request, curationUserSegment, annotationJCas, repository, annotationService); } // check if clicked on an arc else if (!action.isEmpty() && action.toString().equals("selectArcForMerge")) { // add span for merge // get information of the span clicked mergeArc(request, curationUserSegment, annotationJCas); } onChange(aTarget); } }; curationVisualizer.setOutputMarkupId(true); item2.add(curationVisualizer); } }; sentenceListView.setOutputMarkupId(true); add(sentenceListView); }
From source file:de.tudarmstadt.ukp.clarin.webanno.brat.curation.component.SuggestionViewPanel.java
License:Apache License
private void mergeSpan(IRequestParameters aRequest, CurationUserSegmentForAnnotationDocument aCurationUserSegment, JCas aJcas, RepositoryService aRepository, AnnotationService aAnnotationService) throws BratAnnotationException, UIMAException, ClassNotFoundException, IOException { Integer address = aRequest.getParameterValue("id").toInteger(); String spanType = removePrefix(aRequest.getParameterValue("type").toString()); String username = aCurationUserSegment.getUsername(); SourceDocument sourceDocument = aCurationUserSegment.getBratAnnotatorModel().getDocument(); AnnotationDocument clickedAnnotationDocument = null; List<AnnotationDocument> annotationDocuments = aRepository.listAnnotationDocuments(sourceDocument); for (AnnotationDocument annotationDocument : annotationDocuments) { if (annotationDocument.getUser().equals(username)) { clickedAnnotationDocument = annotationDocument; break; }/*from w w w. j a v a 2 s . c o m*/ } createSpan(spanType, aCurationUserSegment.getBratAnnotatorModel(), aJcas, clickedAnnotationDocument, address, null, null, false); }
From source file:de.tudarmstadt.ukp.clarin.webanno.brat.curation.component.SuggestionViewPanel.java
License:Apache License
private void mergeArc(IRequestParameters aRequest, CurationUserSegmentForAnnotationDocument aCurationUserSegment, JCas aJcas) throws NoOriginOrTargetAnnotationSelectedException, ArcCrossedMultipleSentenceException, BratAnnotationException, IOException, UIMAException, ClassNotFoundException { Integer addressOriginClicked = aRequest.getParameterValue("originSpanId").toInteger(); Integer addressTargetClicked = aRequest.getParameterValue("targetSpanId").toInteger(); String arcType = removePrefix(aRequest.getParameterValue("type").toString()); String fsArcaddress = aRequest.getParameterValue("arcId").toString(); // add span for merge // get information of the span clicked String username = aCurationUserSegment.getUsername(); BratAnnotatorModel bModel = aCurationUserSegment.getBratAnnotatorModel(); SourceDocument sourceDocument = bModel.getDocument(); AnnotationDocument clickedAnnotationDocument = null; List<AnnotationDocument> annotationDocuments = repository.listAnnotationDocuments(sourceDocument); for (AnnotationDocument annotationDocument : annotationDocuments) { if (annotationDocument.getUser().equals(username)) { clickedAnnotationDocument = annotationDocument; break; }/*from ww w. ja va 2 s. co m*/ } JCas clickedJCas = null; try { clickedJCas = getJCas(bModel, clickedAnnotationDocument); } catch (IOException e1) { throw new IOException(); } AnnotationFS originFsClicked = selectByAddr(clickedJCas, addressOriginClicked); AnnotationFS targetFsClicked = selectByAddr(clickedJCas, addressTargetClicked); AnnotationFS originFs = selectSingleFsAt(aJcas, originFsClicked.getType(), originFsClicked.getBegin(), originFsClicked.getEnd()); AnnotationFS targetFs = selectSingleFsAt(aJcas, targetFsClicked.getType(), targetFsClicked.getBegin(), targetFsClicked.getEnd()); if (originFs == null | targetFs == null) { throw new NoOriginOrTargetAnnotationSelectedException( "Either origin or target annotations not selected"); } long layerId = TypeUtil.getLayerId(arcType); AnnotationLayer layer = annotationService.getLayer(layerId); int address = Integer.parseInt(fsArcaddress.split("\\.")[0]); AnnotationFS fsClicked = selectByAddr(clickedJCas, address); // this is a slot if (fsArcaddress.contains(".")) { Integer fiIndex = Integer.parseInt(fsArcaddress.split("\\.")[1]); Integer liIndex = Integer.parseInt(fsArcaddress.split("\\.")[2]); AnnotationFeature slotFeature = null; LinkWithRoleModel linkRole = null; int fi = 0; f: for (AnnotationFeature feat : annotationService.listAnnotationFeature(layer)) { if (MultiValueMode.ARRAY.equals(feat.getMultiValueMode()) && LinkMode.WITH_ROLE.equals(feat.getLinkMode())) { List<LinkWithRoleModel> links = getFeature(fsClicked, feat); for (int li = 0; li < links.size(); li++) { LinkWithRoleModel link = links.get(li); if (fi == fiIndex && li == liIndex) { slotFeature = feat; link.targetAddr = getAddr(targetFs); linkRole = link; break f; } } } fi++; } createSpan(arcType, aCurationUserSegment.getBratAnnotatorModel(), aJcas, clickedAnnotationDocument, address, slotFeature, linkRole, true); } else { ArcAdapter adapter = (ArcAdapter) getAdapter(annotationService, layer); Sentence sentence = selectSentenceAt(aJcas, bModel.getSentenceBeginOffset(), bModel.getSentenceEndOffset()); int start = sentence.getBegin(); int end = selectByAddr(aJcas, Sentence.class, getLastSentenceAddressInDisplayWindow(aJcas, getAddr(sentence), bModel.getPreferences().getWindowSize())).getEnd(); // Add annotation - we set no feature values yet. int selectedSpanId = getAddr(adapter.add(originFs, targetFs, aJcas, start, end, null, null)); // Set the feature values for (AnnotationFeature feature : annotationService.listAnnotationFeature(layer)) { if (feature.getName().equals(WebAnnoConst.COREFERENCE_RELATION_FEATURE)) { continue; } if (feature.isEnabled()) { Feature uimaFeature = fsClicked.getType().getFeatureByBaseName(feature.getName()); adapter.updateFeature(aJcas, feature, selectedSpanId, fsClicked.getFeatureValueAsString(uimaFeature)); } } } repository.writeCas(bModel.getMode(), bModel.getDocument(), bModel.getUser(), aJcas); // update timestamp int sentenceNumber = getSentenceNumber(clickedJCas, originFs.getBegin()); bModel.setSentenceNumber(sentenceNumber); bModel.getDocument().setSentenceAccessed(sentenceNumber); if (bModel.getPreferences().isScrollPage()) { address = getAddr( selectSentenceAt(aJcas, bModel.getSentenceBeginOffset(), bModel.getSentenceEndOffset())); bModel.setSentenceAddress(getSentenceBeginAddress(aJcas, address, originFs.getBegin(), bModel.getProject(), bModel.getDocument(), bModel.getPreferences().getWindowSize())); Sentence sentence = selectByAddr(aJcas, Sentence.class, bModel.getSentenceAddress()); bModel.setSentenceBeginOffset(sentence.getBegin()); bModel.setSentenceEndOffset(sentence.getEnd()); Sentence firstSentence = selectSentenceAt(clickedJCas, bModel.getSentenceBeginOffset(), bModel.getSentenceEndOffset()); int lastAddressInPage = getLastSentenceAddressInDisplayWindow(clickedJCas, getAddr(firstSentence), bModel.getPreferences().getWindowSize()); // the last sentence address in the display window Sentence lastSentenceInPage = (Sentence) selectByAddr(clickedJCas, FeatureStructure.class, lastAddressInPage); bModel.setFSN(getSentenceNumber(clickedJCas, firstSentence.getBegin())); bModel.setLSN(getSentenceNumber(clickedJCas, lastSentenceInPage.getBegin())); } }
From source file:de.tudarmstadt.ukp.dkpro.uby.vis.webapp.tryUby.TryUby.java
License:Apache License
public void initVisualView() { senseAlignVis = new SenseAlign("visualPanel") { private static final long serialVersionUID = 1L; @Override/* w w w.j a va2 s . c om*/ protected void onClicked(IRequestParameters request, AjaxRequestTarget target) { String tab = (request.getParameterValue("tab")).toString(); if (tab.contains("2")) { StringValue word = request.getParameterValue("word"); StringValue senseId = request.getParameterValue("senseId"); StringValue senseDefinition = request.getParameterValue("senseDefination"); StringValue synsetDefinition = request.getParameterValue("synsetDefinition"); StringValue senseExample = request.getParameterValue("senseExample"); Map<String, StringValue> SenseDetails = new TreeMap<String, StringValue>(); SenseDetails.put("word", word); SenseDetails.put("senseId", senseId); SenseDetails.put("senseDefinition", senseDefinition); SenseDetails.put("synsetDefinition", synsetDefinition); SenseDetails.put("senseExample", senseExample); List<Map<String, StringValue>> testList = new ArrayList<Map<String, StringValue>>(); testList.add(SenseDetails); IModel textData; textData = new ListModel<Map<String, StringValue>>(testList); senseAlignText.setDetailSense(textData); senseAlignText.tabpanel.setSelectedTab(1); target.add(senseAlignText); } else if (tab.contains("3")) { StringValue firstSenseId = request.getParameterValue("firstSenseId"); StringValue firstSynsetDefinition = request.getParameterValue("firstSynsetDefinition"); StringValue firstSenseDefination = request.getParameterValue("firstSenseDefination"); StringValue firstSenseExample = request.getParameterValue("firstSenseExample"); StringValue secondSenseId = request.getParameterValue("secondSenseId"); StringValue secondSynsetDefinition = request.getParameterValue("secondSynsetDefinition"); StringValue secondSenseDefination = request.getParameterValue("secondSenseDefination"); StringValue secondSenseExample = request.getParameterValue("secondSenseExample"); Map<String, StringValue> firstSenseDetails = new TreeMap<String, StringValue>(); firstSenseDetails.put("senseId", firstSenseId); firstSenseDetails.put("senseDefinition", firstSenseDefination); firstSenseDetails.put("synsetDefinition", firstSynsetDefinition); firstSenseDetails.put("senseExample", firstSenseExample); Map<String, StringValue> secondSenseDetails = new TreeMap<String, StringValue>(); secondSenseDetails.put("senseId", secondSenseId); secondSenseDetails.put("senseDefinition", secondSenseDefination); secondSenseDetails.put("synsetDefinition", secondSynsetDefinition); secondSenseDetails.put("senseExample", secondSenseExample); List<Map<String, StringValue>> testList = new ArrayList<Map<String, StringValue>>(); testList.add(firstSenseDetails); testList.add(secondSenseDetails); IModel textData; textData = new ListModel<Map<String, StringValue>>(testList); senseAlignText.setCompareData(textData); senseAlignText.tabpanel.setSelectedTab(2); target.add(senseAlignText); } } }; senseAlignVis.setLemma(this.param); senseAlignVis.loadSenseData(); senseAlignVis.setOrder(this.selected); add(senseAlignVis); }
From source file:jp.xet.uncommons.wicket.gp.CsrfSecureForm.java
License:Apache License
@Override protected void onValidate() { super.onValidate(); IRequestParameters params = getRequest().getRequestParameters(); String actualKey = params.getParameterValue(INPUT_NAME).toString(); logger.trace("CSRF checking {}:{} - actual = {}, expected = {}", new Object[] { getPage().getClass().getName(), getPageRelativePath(), actualKey, csrfToken }); if (ignoreKeyForTest == false && Objects.equal(actualKey, csrfToken) == false) { logger.warn("CSRF detected in {}:{} - actual = {}, expected = {}", new Object[] { getPage().getClass().getName(), getPageRelativePath(), actualKey, csrfToken }); throw new AbortWithHttpErrorCodeException(HttpServletResponse.SC_BAD_REQUEST); } else {/*from ww w. j a v a2s . co m*/ logger.debug("submit successfully."); initCsrfToken(); } }