/** * Gets a model object as a string. Depending on the "escape model strings" flag of the * component, the string is either HTML escaped or not. "HTML escaped" meaning that only HTML * sensitive chars are escaped but not all none-ascii chars. Proper HTML encoding should be used * instead. In case you really need a fully escaped model string you may call * {@link Strings#escapeMarkup(String, boolean, boolean)} on the model string returned. * * @see Strings#escapeMarkup(String, boolean, boolean) * @see #getEscapeModelStrings() * * @return Model object for this component as a string */ public final String getModelObjectAsString() { return getModelObjectAsString(getModelObject()); }
public boolean compare(Component component, Object b) { final Object a = component.getModelObject(); if (a == null && b == null) { return true; } if (a == null || b == null) { return false; } return a.equals(b); } };
Object modelObject = component.getModelObject(); if (modelObject instanceof ResourceReference)
/** * Asserts the model value of a component. * * @param path * path to the component on the page * @param expectedValue * expected value of the component's model */ public void assertModelValue(String path, Object expectedValue) { Component component = getComponentFromLastRenderedPage(path); Assert.assertEquals(expectedValue, component.getModelObject()); }
public void onComponentTag(Component component, ComponentTag tag) { TreeNode node = (TreeNode)component.getModelObject(); if (getTreeState().isNodeSelected(node)) { CharSequence oldClass = tag.getString("class"); if (Strings.isEmpty(oldClass)) { tag.put("class", getSelectedClass()); } else { tag.put("class", oldClass + " " + getSelectedClass()); } } } });