List of usage examples for org.apache.wicket AttributeModifier toString
@Override
public String toString()
From source file:org.geoserver.web.demo.MapPreviewPageTest.java
License:Open Source License
@Test public void testWfsOutputFormatValueUrlEncoding() { tester.startPage(MapPreviewPage.class); tester.assertRenderedPage(MapPreviewPage.class); Label optionLabel = (Label) tester.getComponentFromLastRenderedPage( "table:listContainer:items:4:itemProperties:4:component:menu:wfs:wfsFormats:3"); assertTrue(optionLabel.getDefaultModelObjectAsString().equals("GML3.2")); for (Iterator<IBehavior> itBehaviors = optionLabel.getBehaviors().iterator(); itBehaviors.hasNext();) { IBehavior b = (IBehavior) (itBehaviors.next()); if (b instanceof AttributeModifier) { AttributeModifier am = (AttributeModifier) b; String url = am.toString(); assertTrue(!url.contains("gml+xml")); assertTrue(url.contains("gml%2Bxml")); break; }/* ww w .j a v a 2s. c o m*/ } }
From source file:org.geoserver.web.demo.MapPreviewPageTest.java
License:Open Source License
private void assertMaxFeaturesInData(DataView data, int maxFeatures) { for (Iterator it = data.iterator(); it.hasNext();) { MarkupContainer c = (MarkupContainer) it.next(); MarkupContainer list = (MarkupContainer) c.get("itemProperties:4:component:menu"); for (Iterator<IBehavior> itBehaviors = list.getBehaviors().iterator(); itBehaviors.hasNext();) { IBehavior b = (IBehavior) (itBehaviors.next()); if (b instanceof AttributeModifier) { AttributeModifier am = (AttributeModifier) b; String url = am.toString(); if (maxFeatures > 0) { assertTrue(url.contains("&maxFeatures=" + maxFeatures)); } else { assertTrue(!url.contains("&maxFeatures=")); }//w w w.j a va 2s.c o m } } } }
From source file:org.geoserver.wms.web.data.publish.WMSLayerConfigTest.java
License:Open Source License
@Test public void testLegendGraphicURL() throws Exception { // force style into ponds workspace Catalog catalog = getCatalog();//from ww w. java 2 s .c o m StyleInfo style = catalog.getStyleByName(MockData.PONDS.getLocalPart()); WorkspaceInfo ws = catalog.getWorkspaceByName(MockData.PONDS.getPrefix()); style.setWorkspace(ws); catalog.save(style); final LayerInfo layer = getCatalog().getLayerByName(MockData.PONDS.getLocalPart()); FormTestPage page = new FormTestPage(new ComponentBuilder() { public Component buildComponent(String id) { return new WMSLayerConfig(id, new Model(layer)); } }); tester.startPage(page); tester.assertRenderedPage(FormTestPage.class); tester.debugComponentTrees(); Image img = (Image) tester.getComponentFromLastRenderedPage("form:panel:styles:defaultStyleLegendGraphic"); assertNotNull(img); assertEquals(1, img.getBehaviors().size()); assertTrue(img.getBehaviors().get(0) instanceof AttributeModifier); AttributeModifier mod = (AttributeModifier) img.getBehaviors().get(0); assertTrue(mod.toString().contains("wms?REQUEST=GetLegendGraphic")); assertTrue(mod.toString().contains("style=cite:Ponds")); }
From source file:org.projectforge.web.wicket.WicketPageTestBase.java
License:Open Source License
/** * Searches ContentMenuEntryPanels.// w ww . ja v a2 s .c o m * @param container * @param accessKey * @return Found component with the given label or null if no such component found. * @see FormComponent#getModelObject() * @see LabeledWebMarkupContainer#getLabel() * @see ContentMenuEntryPanel#getLabel() */ public Component findComponentByAccessKey(final MarkupContainer container, final char accessKey) { final Component[] component = new Component[1]; container.visitChildren(new IVisitor<Component, Void>() { @Override public void component(final Component object, final IVisit<Void> visit) { if (object instanceof AbstractLink) { final AbstractLink link = (AbstractLink) object; final AttributeModifier attrMod = WicketUtils.getAttributeModifier(link, "accesskey"); if (attrMod == null || attrMod.toString().contains("object=[n]") == false) { return; } component[0] = object; visit.stop(); } } }); return component[0]; }