Package org.geoserver.web.data.store.panel

Source Code of org.geoserver.web.data.store.panel.PasswordParamPanel

/* Copyright (c) 2001 - 2007 TOPP - www.openplans.org. All rights reserved.
* This code is licensed under the GPL 2.0 license, available at the root
* application directory.
*/
package org.geoserver.web.data.store.panel;

import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.PasswordTextField;
import org.apache.wicket.markup.html.form.validation.FormComponentFeedbackBorder;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;

/**
* A label with a password field
*
* @author Gabriel Roldan
*/
public class PasswordParamPanel extends Panel {

    private static final long serialVersionUID = -7801141820174575611L;

    private final PasswordTextField passwordField;

    public PasswordParamPanel(final String id, final IModel model, final IModel paramLabelModel,
            final boolean required) {
        super(id, model);
        String requiredMark = required ? " *" : "";
        add(new Label("paramName", paramLabelModel.getObject() + requiredMark));

        passwordField = new PasswordTextField("paramValue", model);
        passwordField.setRequired(required);
        // set the label to be the paramLabelModel otherwise a validation error would look like
        // "Parameter 'paramValue' is required"
        passwordField.setLabel(paramLabelModel);

        // we want to password to stay there if already is
        passwordField.setResetPassword(false);

        FormComponentFeedbackBorder requiredFieldFeedback;
        requiredFieldFeedback = new FormComponentFeedbackBorder("border");

        requiredFieldFeedback.add(passwordField);

        add(requiredFieldFeedback);
    }

    public PasswordTextField getFormComponent() {
        return passwordField;
    }

}
TOP

Related Classes of org.geoserver.web.data.store.panel.PasswordParamPanel

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.