Example usage for org.apache.wicket Component getPath

List of usage examples for org.apache.wicket Component getPath

Introduction

In this page you can find the example usage for org.apache.wicket Component getPath.

Prototype

public final String getPath() 

Source Link

Document

Gets this component's path.

Usage

From source file:org.ops4j.pax.wicket.util.serialization.PaxWicketSerializableChecker.java

License:Apache License

/**
 * Dump with indentation./*from w w  w .  j  ava  2s . c  o m*/
 * 
 * @param type the type that couldn't be serialized
 * @return A very pretty dump
 */
private final String toPrettyPrintedStack(String type) {
    StringBuffer result = new StringBuffer();
    StringBuffer spaces = new StringBuffer();
    result.append("Unable to serialize class: ");
    result.append(type);
    result.append("\nField hierarchy is:");
    for (Iterator<TraceSlot> i = traceStack.listIterator(); i.hasNext();) {
        spaces.append("  ");
        TraceSlot slot = i.next();
        result.append("\n").append(spaces).append(slot.fieldDescription);
        result.append(" [class=").append(slot.object.getClass().getName());
        if (slot.object instanceof Component) {
            Component component = (Component) slot.object;
            result.append(", path=").append(component.getPath());
        }
        result.append("]");
    }
    result.append(" <----- field that is not serializable");
    return result.toString();
}

From source file:org.patientview.radar.web.visitors.PatientFormVisitor.java

License:Open Source License

public void component(Component component, IVisit iVisit) {
    //add onkeyup event to date to santise input - tried attaching behaviour in the component class itself
    // but did not work
    if (component instanceof RadarDateTextField || component instanceof RadarRequiredDateTextField) {
        component.add(new AttributeModifier("onkeyup", "radarUtility.sanitiseDateInput(this);"));
    }/*from w  ww  .  j  a  va 2s  .c o  m*/

    // add validator to date components - adding it inside the component constructor does not work
    if (component instanceof RadarDateTextField || component instanceof RadarRequiredDateTextField) {
        component.add(new RadarDateValidator());
    }

    //if form component - mark form as dirty onchange
    if (component instanceof FormComponent || component instanceof Radio) {
        // ignore the subform components
        String[] ignoreParents = { "immunosuppression", "plasmapheresispanel", "dialysiscontainer",
                "transplantscontainer", "rejectDataContainer", "editTransplantContainer", "addTransplantForm" };

        // ignore record switchers
        String[] ignoreIds = { "switcher" };

        boolean ignoreComponent = false;
        for (String ignore : ignoreParents) {
            if (component.getPath().toLowerCase().contains(ignore.toLowerCase())) {
                ignoreComponent = true;
                break;
            }
        }
        for (String ignore : ignoreIds) {
            if (component.getId().toLowerCase().contains(ignore.toLowerCase())) {
                ignoreComponent = true;
                break;
            }
        }
        if (!ignoreComponent) {
            component.add(new AttributeAppender("onchange", RadarApplication.FORM_IS_DIRTY_TRUE_SCRIPT));
        }
    }

}