List of usage examples for org.apache.wicket Component getMarkupAttributes
public final ValueMap getMarkupAttributes()
From source file:com.comcast.cdn.traffic_control.traffic_monitor.wicket.behaviors.UpdatingAttributeAppender.java
License:Apache License
public String getAttributeValue(final Component c) { String value = null;//from w w w. ja v a2 s . c o m try { final ValueMap atts = c.getMarkupAttributes(); value = toStringOrNull(atts.get(getAttribute())); } catch (MarkupNotFoundException e) { LOGGER.debug(e, e); } final String newValue = newValue(value, toStringOrNull(getReplaceModel().getObject())); return newValue; }
From source file:com.danhaywood.isis.wicket.ui.components.collectioncontents.gmap3.CollectionOfEntitiesAsLocatables.java
License:Apache License
private static void applyCssVisibility(final Component component, final boolean visible) { final AttributeModifier modifier = visible ? new AttributeModifier("class", String.valueOf(component.getMarkupAttributes().get("class")).replaceFirst(INVISIBLE_CLASS, "")) : new AttributeAppender("class", " " + INVISIBLE_CLASS); component.add(modifier);//from w w w. j a v a2 s . c om }
From source file:net.dontdrinkandroot.wicket.bootstrap.component.button.ButtonLink.java
License:Apache License
/** * Appends any anchor to the url if the url is not null and the url does not already contain an * anchor (url.indexOf('#') != -1). This implementation looks whether an anchor component was * set, and if so, it will append the markup id of that component. That markup id is gotten by * either calling {@link Component#getMarkupId()} if {@link Component#getOutputMarkupId()} * returns true, or if the anchor component does not output it's id, this method will try to * retrieve the id from the markup directly. If neither is found, an * {@link WicketRuntimeException exception} is thrown. If no anchor component was set, but the * link component is attached to a <a element, this method will append what is in the href * attribute <i>if</i> there is one, starts with a '#' and has more than one character. * <p>//from w w w . j a va2s . c o m * You can override this method, but it means that you have to take care of whatever is done * with any set anchor component yourself. You also have to manually append the '#' at the right * place. * </p> * * @param tag * The component tag * @param url * The url to start with * @return The url, possibly with an anchor appended */ protected CharSequence appendAnchor(final ComponentTag tag, CharSequence url) { if (url != null) { Component anchor = this.getAnchor(); if (anchor != null) { if (url.toString().indexOf('#') == -1) { String id; if (anchor.getOutputMarkupId()) { id = anchor.getMarkupId(); } else { id = anchor.getMarkupAttributes().getString("id"); } if (id != null) { url = url + "#" + anchor.getMarkupId(); } else { throw new WicketRuntimeException("an achor component was set on " + this + " but it neither has outputMarkupId set to true " + "nor has a id set explicitly"); } } } else { if (tag.getName().equalsIgnoreCase("a")) { if (url.toString().indexOf('#') == -1) { String href = tag.getAttributes().getString("href"); if (href != null && href.length() > 1 && href.charAt(0) == '#') { url = url + href; } } } } } return url; }
From source file:org.apache.isis.viewer.wicket.ui.selector.links.LinksSelectorPanelAbstract.java
License:Apache License
protected static void applyCssVisibility(final Component component, final boolean visible) { final AttributeModifier modifier = visible ? new AttributeModifier("class", String.valueOf(component.getMarkupAttributes().get("class")).replaceFirst(INVISIBLE_CLASS, "")) : new AttributeAppender("class", " " + INVISIBLE_CLASS); component.add(modifier);// w w w. ja v a2s.c om }
From source file:org.obiba.onyx.quartz.core.wicket.layout.impl.simplified.SimplifiedQuestionPanelTest.java
License:Open Source License
private void checkQuestionCategoryLink(String categoryType, int row, int col, String label, boolean selected) { String category = "panel:form:content:content:" + categoryType + ":category"; tester.assertComponent(category + ":" + row + ":cols:" + col + ":input", QuestionCategoryLink.class); // tester.assertComponent(category + ":" + row + ":cols:" + col + ":input", // IQuestionCategorySelectionStateHolder.class); IQuestionCategorySelectionStateHolder stateHolder = (IQuestionCategorySelectionStateHolder) tester .getComponentFromLastRenderedPage(category + ":" + row + ":cols:" + col + ":input"); Assert.assertEquals(selected, stateHolder.wasSelected()); tester.assertComponent(category + ":" + row + ":cols:" + col + ":input:link", AjaxImageLink.class); Component link = tester .getComponentFromLastRenderedPage(category + ":" + row + ":cols:" + col + ":input:link"); Assert.assertEquals("obiba-quartz-category", link.getMarkupAttributes().getString("class")); tester.assertLabel(category + ":" + row + ":cols:" + col + ":input:link:link:label", label); }
From source file:org.obiba.onyx.quartz.core.wicket.layout.impl.simplified.SimplifiedQuestionPanelTest.java
License:Open Source License
private void checkArrayQuestionCategoryLink(int row, int col, boolean selected) { String rows = "panel:form:content:content:array:rows:rows"; tester.assertComponent(rows + ":" + row + ":cells:" + col + ":cell", QuestionCategoryLink.class); // tester.assertComponent(rows + ":" + row + ":cells:" + col + ":cell", // IQuestionCategorySelectionStateHolder.class); IQuestionCategorySelectionStateHolder stateHolder = (IQuestionCategorySelectionStateHolder) tester .getComponentFromLastRenderedPage(rows + ":" + row + ":cells:" + col + ":cell"); Assert.assertEquals(selected, stateHolder.wasSelected()); tester.assertComponent(rows + ":" + row + ":cells:" + col + ":cell:link", AjaxImageLink.class); Component link = tester.getComponentFromLastRenderedPage(rows + ":" + row + ":cells:" + col + ":cell:link"); Assert.assertEquals("obiba-quartz-category", link.getMarkupAttributes().getString("class")); }