Example usage for org.apache.wicket.validation.validator UrlValidator UrlValidator

List of usage examples for org.apache.wicket.validation.validator UrlValidator UrlValidator

Introduction

In this page you can find the example usage for org.apache.wicket.validation.validator UrlValidator UrlValidator.

Prototype

public UrlValidator() 

Source Link

Document

Constructs a UrlValidator with default properties.

Usage

From source file:com.francetelecom.clara.cloud.presentation.designer.services.cfjavaprocessing.LogicalCfJavaProcessingServicePanel.java

License:Apache License

private void initComponents() {

    getServiceForm().add(new CacheActivatedImage("cfjavaprocessing-icon",
            new ResourceModel("cfjavaprocessing.icon").getObject()));
    // Online help link
    String completeHelpUrl = "";
    try {/*  ww w  . j av a  2  s . c  o  m*/
        completeHelpUrl = new StringResourceModel("portal.designer.logical.service.online_manual.baseUrl", null)
                .getString()
                + new StringResourceModel(
                        "portal.designer.logical.service.online_manual." + getLogicalModelType(), null)
                                .getString();
    } catch (Exception e) {
        //do nothing
    }
    ExternalLink onlineHelpLink = new ExternalLink("onlineHelpLink", completeHelpUrl);
    getServiceForm().add(onlineHelpLink);
    if (completeHelpUrl.isEmpty()) {
        onlineHelpLink.setVisible(false);
    }

    // FUNCTIONNAL PARAMETERS
    RequiredTextField<String> label = new RequiredTextField<String>("label");
    label.setLabel(new StringResourceModel("portal.designer.service.cfjava.label", null));
    label.add(new PropertyValidator<>());
    getServiceForm().add(label);

    RequiredTextField<String> groupId = new RequiredTextField<String>("softwareReference.groupId");
    groupId.setLabel(new StringResourceModel("portal.designer.service.cfjava.softwareReference.groupId", null));
    groupId.add(new PropertyValidator<>());
    getServiceForm().add(groupId);

    RequiredTextField<String> artifactId = new RequiredTextField<String>("softwareReference.artifactId");
    artifactId.setLabel(
            new StringResourceModel("portal.designer.service.cfjava.softwareReference.artifactId", null));
    artifactId.add(new PropertyValidator<>());
    getServiceForm().add(artifactId);

    RequiredTextField<String> version = new RequiredTextField<String>("softwareReference.version");
    version.setLabel(new StringResourceModel("portal.designer.service.cfjava.softwareReference.version", null));
    version.add(new PropertyValidator<>());
    getServiceForm().add(version);

    RequiredTextField<String> extension = new RequiredTextField<String>("softwareReference.extension");
    if (getServiceForm().getModelObject().getSoftwareReference() == null) {
        getServiceForm().getModelObject().setSoftwareReference(new MavenReference("", "", "", "war"));
    }
    extension.setLabel(
            new StringResourceModel("portal.designer.service.cfjava.softwareReference.extension", null));
    extension.add(new PropertyValidator<>());
    getServiceForm().add(extension);
    /*List<String> extensionList = new ArrayList<String>();
    extensionList.add("jar");
    extensionList.add("war");
    extensionList.add("ear");
    DropDownChoice<String> extension = new DropDownChoice<String>("softwareReference.extension", extensionList);
    extension.setLabel(new StringResourceModel("portal.designer.service.cfjava.softwareReference.extension",null));
    extension.add(new PropertyValidator<>());
    getServiceForm().add(extension);*/

    TextField<String> classifier = new TextField<String>("softwareReference.classifier", String.class);
    classifier.setLabel(
            new StringResourceModel("portal.designer.service.cfjava.softwareReference.classifier", null));
    classifier.add(new PropertyValidator<>());
    getServiceForm().add(classifier);

    CheckBox optionalSoftwareReference = new CheckBox("optionalSoftwareReference");
    optionalSoftwareReference.setLabel(
            new StringResourceModel("portal.designer.service.cfjava.optionalSoftwareReference", null));
    getServiceForm().add(optionalSoftwareReference);

    TextField<Integer> minMemoryMbHint = new TextField<Integer>("minMemoryMbHint");
    minMemoryMbHint.setLabel(new StringResourceModel("portal.designer.service.cfjava.minMemoryMbHint", null));
    minMemoryMbHint.add(new AttributeModifier("class", "small"));
    minMemoryMbHint.add(new PropertyValidator<>());
    getServiceForm().add(minMemoryMbHint);

    final TextField<String> iconUrl = new TextField<String>("iconUrl");
    iconUrl.setLabel(new StringResourceModel("portal.designer.service.cfjava.iconUrl", null));
    //iconUrl.add(new AttributeModifier("title", new StringResourceModel("portal.designer.service.cfjava.iconUrl.help",null)));
    //Add Wicket validation for URL
    iconUrl.add(new UrlValidator());
    iconUrl.add(new PropertyValidator<>());
    iconUrl.add(new OnChangeAjaxBehavior() {

        /**
        * 
        */
        private static final long serialVersionUID = 1L;

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            // Important, DO NOT DELETE
            // By Calling OnChangeAjaxBehavior, we update iconUrl field model to can push button preview with updated model

        }

        @Override
        protected void onError(AjaxRequestTarget target, RuntimeException e) {
            iconUrl.updateModel(); // The feedback is handle when click on preview button so we need to updateModel when there is an error
        }
    });
    getServiceForm().add(iconUrl);
    getServiceForm().add(new CacheActivatedImage("imageHelp.iconUrl", getString("image.help")));

    WebMarkupContainer imageContainer = new WebMarkupContainer("imageContainer");

    final WebMarkupContainer icon = new WebMarkupContainer("icon");
    icon.setOutputMarkupId(true);
    icon.setOutputMarkupPlaceholderTag(true);
    if (iconUrl.getModelObject() == null || iconUrl.getModelObject().equals("")) {
        setDefaultIconAndUpdateFeedBack(icon, null, "");
    } else {
        setCustomIconAndUpdateFeedBack(icon, iconUrl, null);
    }
    imageContainer.add(icon);

    final Label feedback = new Label("feedbackError", new Model<String>(""));
    feedback.setOutputMarkupId(true);
    imageContainer.add(feedback);

    AjaxLink preview = new AjaxLink("preview", new Model()) {
        @Override
        public void onClick(AjaxRequestTarget target) {
            try {

                //If null or empty when click on preview button, clean feedBack and display default image
                if (iconUrl.getModelObject() == null || iconUrl.getModelObject().equals("")) {
                    setDefaultIconAndCleanFeedBack(icon, feedback);
                } // Else try to display custom image
                else {
                    //Construct URL to test integrity of what user typing
                    URL url = new URL(iconUrl.getModelObject().toString());
                    if (iconUrl.getModelObject() != null) {
                        setCustomIconAndUpdateFeedBack(icon, iconUrl, feedback);
                    }
                }
            } catch (MalformedURLException e) {
                setDefaultIconAndUpdateFeedBack(icon, feedback, e.getMessage());
                e.printStackTrace();
            }
            target.add(icon);
            target.add(feedback);
        }
    };
    imageContainer.add(preview);
    getServiceForm().add(imageContainer);

}

From source file:com.francetelecom.clara.cloud.presentation.designer.services.jeeprocessing.LogicalJeeProcessingServicePanel.java

License:Apache License

private void initComponents() {

    getServiceForm().add(new CacheActivatedImage("logicalJeeProcessingPanelIcon",
            new ResourceModel("jeeProcessing-icon").getObject()));
    // Online help link
    String completeHelpUrl = "";
    try {/* www  .j  a va 2  s.c om*/
        completeHelpUrl = new StringResourceModel("portal.designer.logical.service.online_manual.baseUrl", null)
                .getString()
                + new StringResourceModel(
                        "portal.designer.logical.service.online_manual." + getLogicalModelType(), null)
                                .getString();
    } catch (Exception e) {
        //do nothing
    }
    ExternalLink onlineHelpLink = new ExternalLink("onlineHelpLink", completeHelpUrl);
    getServiceForm().add(onlineHelpLink);
    if (completeHelpUrl.isEmpty()) {
        onlineHelpLink.setVisible(false);
    }

    // FUNCTIONNAL PARAMETERS
    RequiredTextField<String> label = new RequiredTextField<String>("label");
    label.setLabel(new StringResourceModel("portal.designer.service.jee.label", null));
    label.add(new PropertyValidator<>());
    getServiceForm().add(label);

    RequiredTextField<String> groupId = new RequiredTextField<String>("softwareReference.groupId");
    groupId.setLabel(new StringResourceModel("portal.designer.service.jee.softwareReference.groupId", null));
    groupId.add(new PropertyValidator<>());
    getServiceForm().add(groupId);

    RequiredTextField<String> artifactId = new RequiredTextField<String>("softwareReference.artifactId");
    artifactId.setLabel(
            new StringResourceModel("portal.designer.service.jee.softwareReference.artifactId", null));
    artifactId.add(new PropertyValidator<>());
    getServiceForm().add(artifactId);

    RequiredTextField version = new RequiredTextField("softwareReference.version");
    version.setLabel(new StringResourceModel("portal.designer.service.jee.softwareReference.version", null));
    version.add(new PropertyValidator<>());
    getServiceForm().add(version);

    TextField classifier = new TextField("softwareReference.classifier", String.class);
    classifier.setLabel(
            new StringResourceModel("portal.designer.service.jee.softwareReference.classifier", null));
    classifier.add(new PropertyValidator<>());
    getServiceForm().add(classifier);

    CheckBox optionalSoftwareReference = new CheckBox("optionalSoftwareReference");
    optionalSoftwareReference
            .setLabel(new StringResourceModel("portal.designer.service.jee.optionalSoftwareReference", null));
    getServiceForm().add(optionalSoftwareReference);

    TextField minMemoryMbHint = new TextField("minMemoryMbHint");
    minMemoryMbHint.setLabel(new StringResourceModel("portal.designer.service.jee.minMemoryMbHint", null));
    minMemoryMbHint.add(new AttributeModifier("class", "small"));
    minMemoryMbHint.add(new PropertyValidator<>());
    getServiceForm().add(minMemoryMbHint);

    final TextField<String> iconUrl = new TextField<String>("iconUrl");
    iconUrl.setLabel(new StringResourceModel("portal.designer.service.jee.iconUrl", null));
    //iconUrl.add(new AttributeModifier("title", new StringResourceModel("portal.designer.service.jee.iconUrl.help",null)));
    //Add Wicket validation for URL
    iconUrl.add(new UrlValidator());
    iconUrl.add(new PropertyValidator<>());
    iconUrl.add(new OnChangeAjaxBehavior() {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            // Important, DO NOT DELETE
            // By Calling OnChangeAjaxBehavior, we update iconUrl field model to can push button preview with updated model

        }

        @Override
        protected void onError(AjaxRequestTarget target, RuntimeException e) {
            iconUrl.updateModel(); // The feedback is handle when click on preview button so we need to updateModel when there is an error
        }
    });
    getServiceForm().add(iconUrl);
    getServiceForm()
            .add(new CacheActivatedImage("imageHelp.iconUrl", new ResourceModel("image.help").getObject()));

    WebMarkupContainer imageContainer = new WebMarkupContainer("imageContainer");

    final WebMarkupContainer icon = new WebMarkupContainer("icon");
    icon.setOutputMarkupId(true);
    icon.setOutputMarkupPlaceholderTag(true);
    if (iconUrl.getModelObject() == null || iconUrl.getModelObject().equals("")) {
        setDefaultIconAndUpdateFeedBack(icon, null, "");
    } else {
        setCustomIconAndUpdateFeedBack(icon, iconUrl, null);
    }
    imageContainer.add(icon);

    final Label feedback = new Label("feedbackError", new Model<String>(""));
    feedback.setOutputMarkupId(true);
    imageContainer.add(feedback);

    AjaxLink preview = new AjaxLink("preview", new Model()) {
        @Override
        public void onClick(AjaxRequestTarget target) {
            try {

                //If null or empty when click on preview button, clean feedBack and display default image
                if (iconUrl.getModelObject() == null || iconUrl.getModelObject().equals("")) {
                    setDefaultIconAndCleanFeedBack(icon, feedback);
                } // Else try to display custom image
                else {
                    //Construct URL to test integrity of what user typing
                    URL url = new URL(iconUrl.getModelObject().toString());
                    if (iconUrl.getModelObject() != null) {
                        setCustomIconAndUpdateFeedBack(icon, iconUrl, feedback);
                    }
                }
            } catch (MalformedURLException e) {
                setDefaultIconAndUpdateFeedBack(icon, feedback, e.getMessage());
                logger.info("Exception while getting new icon", e);
            }
            target.add(icon);
            target.add(feedback);
        }
    };
    imageContainer.add(preview);
    getServiceForm().add(imageContainer);

}

From source file:com.francetelecom.clara.cloud.presentation.designer.services.nodeprocessing.LogicalNodeProcessingServicePanel.java

License:Apache License

private void initComponents() {

    getServiceForm().add(new CacheActivatedImage("nodeprocessingIcon",
            new ResourceModel("nodeprocessing-icon").getObject()));
    // Online help link
    String completeHelpUrl = "";
    try {//from w w  w . j  ava2s. c  o  m
        completeHelpUrl = new StringResourceModel("portal.designer.logical.service.online_manual.baseUrl", null)
                .getString()
                + new StringResourceModel(
                        "portal.designer.logical.service.online_manual." + getLogicalModelType(), null)
                                .getString();
    } catch (Exception e) {
        //do nothing
    }
    ExternalLink onlineHelpLink = new ExternalLink("onlineHelpLink", completeHelpUrl);
    getServiceForm().add(onlineHelpLink);
    if (completeHelpUrl.isEmpty()) {
        onlineHelpLink.setVisible(false);
    }

    // FUNCTIONNAL PARAMETERS
    /*RequiredTextField<String> label = new RequiredTextField<String>("label");
     label.setLabel(new StringResourceModel("portal.designer.service.cfjava.label",null));
     label.add(new PropertyValidator<>());
     getServiceForm().add(label);
            
     RequiredTextField<String> groupId = new RequiredTextField<String>("softwareReference.groupId");
     groupId.setLabel(new StringResourceModel("portal.designer.service.cfjava.softwareReference.groupId",null));
     groupId.add(new PropertyValidator<>());
     getServiceForm().add(groupId);
            
     RequiredTextField<String> artifactId = new RequiredTextField<String>("softwareReference.artifactId");
     artifactId.setLabel(new StringResourceModel("portal.designer.service.cfjava.softwareReference.artifactId",null));
     artifactId.add(new PropertyValidator<>());
     getServiceForm().add(artifactId);
            
     RequiredTextField<?> version = new RequiredTextField("softwareReference.version");
     version.setLabel(new StringResourceModel("portal.designer.service.cfjava.softwareReference.version",null));
     version.add(new PropertyValidator<>());
     getServiceForm().add(version);
            
     TextField classifier = new TextField("softwareReference.classifier", String.class);
     classifier.setLabel(new StringResourceModel("portal.designer.service.cfjava.softwareReference.classifier",null));
     classifier.add(new PropertyValidator<>());
     getServiceForm().add(classifier);
            
             
     CheckBox optionalSoftwareReference=new CheckBox("optionalSoftwareReference");
     optionalSoftwareReference.setLabel(new StringResourceModel("portal.designer.service.cfjava.optionalSoftwareReference",null));
     getServiceForm().add(optionalSoftwareReference);
             
             
             
     TextField minMemoryMbHint = new TextField("minMemoryMbHint");
     minMemoryMbHint.setLabel(new StringResourceModel("portal.designer.service.cfjava.minMemoryMbHint",null));
     minMemoryMbHint.add(new AttributeModifier("class","small"));
     minMemoryMbHint.add(new PropertyValidator<>());
     getServiceForm().add(minMemoryMbHint);
    */

    //****** Change Icon ******//

    final TextField<String> iconUrl = new TextField<String>("iconUrl");
    iconUrl.setLabel(new StringResourceModel("portal.designer.service.cfjava.iconUrl", null));
    //iconUrl.add(new AttributeModifier("title", new StringResourceModel("portal.designer.service.cfjava.iconUrl.help",null)));
    //Add Wicket validation for URL
    iconUrl.add(new UrlValidator());
    iconUrl.add(new PropertyValidator<>());
    iconUrl.add(new OnChangeAjaxBehavior() {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            // Important, DO NOT DELETE
            // By Calling OnChangeAjaxBehavior, we update iconUrl field model to can push button preview with updated model

        }

        @Override
        protected void onError(AjaxRequestTarget target, RuntimeException e) {
            iconUrl.updateModel(); // The feedback is handle when click on preview button so we need to updateModel when there is an error
        }
    });
    getServiceForm().add(iconUrl);
    getServiceForm().add(new CacheActivatedImage("imageHelp.iconUrl", getString("image.help")));

    WebMarkupContainer imageContainer = new WebMarkupContainer("imageContainer");

    final WebMarkupContainer icon = new WebMarkupContainer("icon");
    icon.setOutputMarkupId(true);
    icon.setOutputMarkupPlaceholderTag(true);
    if (iconUrl.getModelObject() == null || iconUrl.getModelObject().equals("")) {
        setDefaultIconAndUpdateFeedBack(icon, null, "");
    } else {
        setCustomIconAndUpdateFeedBack(icon, iconUrl, null);
    }
    imageContainer.add(icon);

    final Label feedback = new Label("feedbackError", new Model<String>(""));
    feedback.setOutputMarkupId(true);
    imageContainer.add(feedback);

    AjaxLink preview = new AjaxLink("preview", new Model()) {
        @Override
        public void onClick(AjaxRequestTarget target) {
            try {

                //If null or empty when click on preview button, clean feedBack and display default image
                if (iconUrl.getModelObject() == null || iconUrl.getModelObject().equals("")) {
                    setDefaultIconAndCleanFeedBack(icon, feedback);
                } // Else try to display custom image
                else {
                    //Construct URL to test integrity of what user typing
                    URL url = new URL(iconUrl.getModelObject().toString());
                    if (iconUrl.getModelObject() != null) {
                        setCustomIconAndUpdateFeedBack(icon, iconUrl, feedback);
                    }
                }
            } catch (MalformedURLException e) {
                setDefaultIconAndUpdateFeedBack(icon, feedback, e.getMessage());
                e.printStackTrace();
            }
            target.add(icon);
            target.add(feedback);
        }
    };
    imageContainer.add(preview);
    getServiceForm().add(imageContainer);

}

From source file:com.userweave.pages.api.ApiPanel.java

License:Open Source License

private boolean isValidImgUrl(String url) {
    UrlValidator validator = new UrlValidator();

    if (validator.isValid(url)) {
        return true;
    }//from  www .  j  av  a2  s .  c o  m

    return false;
}

From source file:jp.go.nict.langrid.management.web.view.component.text.RequiredURLField.java

License:Open Source License

/**
 * 
 * 
 */
public RequiredURLField(String componentId) {
    super(componentId);
    add(new UrlValidator());
    setRequired(true);
}

From source file:jp.go.nict.langrid.management.web.view.component.text.RequiredURLField.java

License:Open Source License

/**
 * //  www  . jav  a  2  s  .  c  o  m
 * 
 */
public RequiredURLField(String componentId, IModel<String> model) {
    super(componentId, model);
    add(new UrlValidator());
    setRequired(true);
}

From source file:jp.go.nict.langrid.management.web.view.component.text.RequiredURLField.java

License:Open Source License

/**
 * /*from   w  w  w.  j a  va2  s.c o  m*/
 * 
 */
public RequiredURLField(String componentId, IModel<String> model, String validateMessageKey) {
    super(componentId, model);
    add(new UrlValidator());
    add(new RequiredValidator<String>(validateMessageKey));
}

From source file:jp.go.nict.langrid.management.web.view.page.user.component.text.RequiredHomepageField.java

License:Open Source License

/**
 * //from  www .  java 2s.c  o  m
 * 
 */
public RequiredHomepageField(String componentId, IModel<String> model) {
    super(componentId, model);
    add(new UrlValidator());
}

From source file:org.geoserver.web.admin.GlobalSettingsPage.java

License:Open Source License

public GlobalSettingsPage() {
    final IModel globalInfoModel = getGlobalInfoModel();
    final IModel loggingInfoModel = getLoggingInfoModel();

    CompoundPropertyModel compoundPropertyModel = new CompoundPropertyModel(globalInfoModel);
    Form form = new Form("form", compoundPropertyModel);

    add(form);/*from  w  w  w. j ava2s.  c  o m*/

    form.add(new CheckBox("verbose"));
    form.add(new CheckBox("verboseExceptions"));
    form.add(new CheckBox("globalServices"));
    form.add(new TextField<Integer>("numDecimals").add(new MinimumValidator<Integer>(0)));
    form.add(new DropDownChoice("charset", AVAILABLE_CHARSETS));
    form.add(new DropDownChoice<ResourceErrorHandling>("resourceErrorHandling",
            Arrays.asList(ResourceErrorHandling.values()), new ResourceErrorHandlingRenderer()));
    form.add(new TextField("proxyBaseUrl").add(new UrlValidator()));

    logLevelsAppend(form, loggingInfoModel);
    form.add(new CheckBox("stdOutLogging", new PropertyModel(loggingInfoModel, "stdOutLogging")));
    form.add(new TextField("loggingLocation", new PropertyModel(loggingInfoModel, "location")));

    TextField xmlPostRequestLogBufferSize = new TextField("xmlPostRequestLogBufferSize",
            new PropertyModel(globalInfoModel, "xmlPostRequestLogBufferSize"));
    xmlPostRequestLogBufferSize.add(new MinimumValidator<Integer>(0));
    form.add(xmlPostRequestLogBufferSize);

    form.add(new CheckBox("xmlExternalEntitiesEnabled"));

    form.add(new TextField<Integer>("featureTypeCacheSize").add(new MinimumValidator<Integer>(0)));

    IModel<String> lockProviderModel = new PropertyModel<String>(globalInfoModel, "lockProviderName");
    ApplicationContext applicationContext = GeoServerApplication.get().getApplicationContext();
    List<String> providers = new ArrayList<String>(
            Arrays.asList(applicationContext.getBeanNamesForType(LockProvider.class)));
    providers.remove("lockProvider"); // remove the global lock provider
    Collections.sort(providers);
    ;

    DropDownChoice<String> lockProviderChoice = new DropDownChoice<String>("lockProvider", lockProviderModel,
            providers, new LocalizedChoiceRenderer(this));

    form.add(lockProviderChoice);

    // Extension plugin for Global Settings
    // Loading of the settings from the Global Info
    IModel<SettingsInfo> settingsModel = new PropertyModel<SettingsInfo>(globalInfoModel, "settings");
    ListView extensions = SettingsPluginPanelInfo.createExtensions("extensions", settingsModel,
            getGeoServerApplication());
    form.add(extensions);

    Button submit = new Button("submit", new StringResourceModel("submit", this, null)) {
        @Override
        public void onSubmit() {
            GeoServer gs = getGeoServer();
            gs.save((GeoServerInfo) globalInfoModel.getObject());
            gs.save((LoggingInfo) loggingInfoModel.getObject());
            doReturn();
        }
    };
    form.add(submit);

    Button cancel = new Button("cancel") {
        @Override
        public void onSubmit() {
            doReturn();
        }
    };
    form.add(cancel);
}

From source file:org.geoserver.web.services.BaseServiceAdminPage.java

License:Open Source License

void init(final IModel<T> infoModel) {
    T service = infoModel.getObject();//from  ww w.  j  a v  a  2  s  . co m

    dialog = new GeoServerDialog("dialog");
    add(dialog);

    Form form = new Form("form", new CompoundPropertyModel(infoModel));
    add(form);

    if (service.getWorkspace() == null) {
        //create the panel that has the drop down list to switch between workspace
        form.add(new GlobalWorkspacePanel("workspace"));
    } else {
        //create just a panel with a label that signifies the workspace
        form.add(new LocalWorkspacePanel("workspace", service));
    }

    form.add(new HelpLink("workspaceHelp").setDialog(dialog));

    form.add(new Label("service.enabled",
            new StringResourceModel("service.enabled", this, null, new Object[] { getServiceName() })));
    form.add(new TextField("maintainer"));
    TextField onlineResource = new TextField("onlineResource");
    onlineResource.add(new UrlValidator());
    form.add(onlineResource);
    form.add(new CheckBox("enabled"));
    form.add(new CheckBox("citeCompliant"));
    form.add(new TextField("title"));
    form.add(new TextArea("abstract"));
    form.add(
            new KeywordsEditor("keywords", LiveCollectionModel.list(new PropertyModel(infoModel, "keywords"))));
    form.add(new TextField("fees"));
    form.add(new TextField("accessConstraints"));

    build(infoModel, form);

    //add the extension panels
    ListView extensionPanels = createExtensionPanelList("extensions", infoModel);
    extensionPanels.setReuseItems(true);
    form.add(extensionPanels);

    SubmitLink submit = new SubmitLink("submit", new StringResourceModel("save", (Component) null, null)) {
        @Override
        public void onSubmit() {
            try {
                handleSubmit((T) infoModel.getObject());
                doReturn();
            } catch (Exception e) {
                error(e);
            }
        }
    };
    form.add(submit);

    Button cancel = new Button("cancel", new StringResourceModel("cancel", (Component) null, null)) {
        public void onSubmit() {
            doReturn();
        }
    };
    form.add(cancel);
    //cancel.setDefaultFormProcessing( false );
}