Package org.apache.wicket.markup.html.form

Examples of org.apache.wicket.markup.html.form.Button


        repositories = getRepositoryManager().getRepositories();
        form.add(new DropDownChoice("repositorySelection", new PropertyModel(
                this, "selectedRepository"), repositories, new ChoiceRenderer(
                "name", "name")));

        Button selectButton = new Button("selectButton")
        {

            private static final long serialVersionUID = 1L;

            public void onSubmit()
View Full Code Here


    }

    @Override
    protected Button saveButton(String componentId)
    {
        return new Button(componentId)
        {
            private static final long serialVersionUID = 1L;

            @Override
            public void onSubmit()
View Full Code Here

            add(new FileUploadField("importFile", new PropertyModel(this, "fileName")));
            add(new Label("importFileLabel", new ResourceModel("import.choose.file")));

            add(new Label("importText", new ResourceModel("import.text")));
            add(new Button("importAction", new ResourceModel("import.action")));

            add((new Label("importErrorMessage", new PropertyModel(this, "errorMessage"))
            {

                @Override
View Full Code Here

            }

            @Override
            protected Button saveButton(String componentId)
            {
                return new Button(componentId)
                {

                    @Override
                    public void onSubmit()
                    {
View Full Code Here

    }

    @Override
    protected Button saveButton(String componentId)
    {
        return new Button(componentId)
        {
            @Override
            public void onSubmit()
            {
                FeedbackPanel feed = (FeedbackPanel) getPage().get("feedback");
View Full Code Here

        userPrefernces.add(new RequiredTextField("templateDir", new PropertyModel(this, "templateDir")));
        userPrefernces.add(new Label("profileLabel", new ResourceModel("default.profile")));
        userPrefernces.add(new DropDownChoice("profile", new PropertyModel(this, "profile"), getProfileList));
        userPrefernces.add(new Label("roleLabel", new ResourceModel("default.role")));
        userPrefernces.add(new DropDownChoice("role", new PropertyModel(this, "role"), getRoleNames));
        userPrefernces.add(new Button("addUserPrefernces", new ResourceModel("common.save"))
        {
            @Override
            public void onSubmit()
            {
                PortletRequest request = ((AbstractAdminWebApplication) getApplication()).getPortletRequest();
View Full Code Here

                    }
                }
            };
            userAttrsForm.add(usersList);
            userAttrsForm.add(new PagingNavigator("navigator", usersList));
            Button updateAttrButton = new Button("updateAttr",
                    new ResourceModel("common.update"))
            {

                public void onSubmit()
                {
                    Map<String, SecurityAttribute> attribs = getPrincipal().getSecurityAttributes().getAttributeMap() ;
                    for (Iterator it = userAttributes.iterator(); it.hasNext();)
                    {
                        Map userAttrMap = (Map) it.next();
                        String userAttrName = (String) userAttrMap.get("name");
                        String userAttrValue = ((SecurityAttribute) userAttrMap
                                .get("value")).getStringValue();
                        String oldUserAttrValue = attribs.get(userAttrName).getStringValue();
                        Map<String,SecurityAttribute> userAttributes = getPrincipal().getSecurityAttributes().getAttributeMap();
                        try
                        {
                            getPrincipal().getSecurityAttributes().getAttribute(userAttrName).setStringValue(userAttrValue);
                        }
                        catch (SecurityException e)
                        {
                            log.error("Failed to update security attribute of principal.", e);
                        }                       
                        getServiceLocator()
                                .getAuditActivity()
                                .logAdminAttributeActivity(
                                        getPrincipal().getName(),
                                        getIPAddress(),
                                        getPrincipal().getName(),
                                        AuditActivity.USER_UPDATE_ATTRIBUTE,
                                        userAttrName, oldUserAttrValue,
                                        userAttrValue,
                                        AdminPortletWebPage.USER_ADMINISTRATION);
                    }
                    try
                    {
                        getManager().updatePrincipal(getPrincipal());
                    }
                    catch (SecurityException e)
                    {
                        error(e.getMessage());
                    }
                    refreshData();
                }
            };      
           
            userAttrsForm.add(updateAttrButton);
            Form addAttrForm = new Form("addAttrForm")
            {

                protected void onSubmit()
                {
                    String userAttrName = getUserAttrName();
                    String userAttrValue = getUserAttrValue();
                    if (userAttrName != null
                            && userAttrName.trim().length() > 0)
                    {
                        // Preferences prefs = user.getUserAttributes();
                        // prefs.put(userAttrName, userAttrValue);
                        try
                        {
                            getPrincipal().getSecurityAttributes()
                                    .getAttribute(userAttrName, true)
                                    .setStringValue(userAttrValue);
                            getManager().updatePrincipal(getPrincipal());
                            getServiceLocator()
                                    .getAuditActivity()
                                    .logAdminAttributeActivity(
                                            getPrincipal().getName(),
                                            getIPAddress(),
                                            getPrincipal().getName(),
                                            AuditActivity.USER_ADD_ATTRIBUTE,
                                            userAttrName,
                                            "",
                                            userAttrValue,
                                            AdminPortletWebPage.USER_ADMINISTRATION);
                        }
                        catch (SecurityException e)
                        {
                            log.error("Failed to update security attribute of principal.", e);
                        }
                    }
                    setPrincipal(getPrincipal());
                    refreshData();
                }
            };
            add(addAttrForm);
            addAttrForm.add(new Label("nameLabel", new ResourceModel(
                    "common.name")));
            TextField userAttrNameField = new RequiredTextField("userAttrName",
                    new PropertyModel(this, "userAttrName"));
            addAttrForm.add(userAttrNameField);
            addAttrForm.add(new Label("valueLabel", new ResourceModel(
                    "common.value")));
            TextField userAttrValueField = new RequiredTextField(
                    "userAttrValue", new PropertyModel(this, "userAttrValue"));
            addAttrForm.add(userAttrValueField);
            addAttrForm.add(new Button("addAttr", new ResourceModel(
                    "common.attribute.add")));
        }
View Full Code Here

            add(profileForm);
            profileForm.add(new CheckBox("userStatus", new PropertyModel(this,
                    "userEnabled")));
            profileForm.add(new Label("enabledLabel", new ResourceModel(
                    "common.enabled")));
            profileForm.add(new Button("submit", new ResourceModel(
                    principalParam + ".update.button")){
                @Override
                public void onSubmit()
                {
                    JetspeedPrincipal principal = getManager().getPrincipal(
                            getName());
                    try
                    {
                        principal.setEnabled(isUserEnabled());
                        getManager().updatePrincipal(principal);
                        setPrincipal(principal);
                        principalDataProvider.refresh(getManager(),getSearchString());
                    } catch (SecurityException jSx)
                    {
                        error(jSx.getMessage());
                    }
                }
            });
            profileForm.add(new Button("remove", new ResourceModel(principalParam + ".remove.button")){
                @Override
                public void onSubmit()
                {
                    try
                    {
View Full Code Here

    @SuppressWarnings("serial")
    public UploadPortletApp(DeploymentManager dm)
    {
        this.dm = dm;
        FileUploadForm form = new FileUploadForm("uploadForm");
        form.add(new Button("uploadFile", new ResourceModel("pam.details.action.uploadFile"))
        {
            /*
             * (non-Javadoc)
             * @see org.apache.wicket.markup.html.form.Button#onSubmit()
             */
            @Override
            public void onSubmit()
            {
                AbstractAdminWebApplication app = ((AbstractAdminWebApplication)getApplication());
                FeedbackPanel feedback = (FeedbackPanel) UploadPortletApp.this.get("feedback");
                final FileUpload upload = fileUpload;
                if (upload != null)
                {
                    InputStream warStream = null;
                    File tempFile = null;
                    try
                    {
                        warStream = upload.getInputStream();           
                        tempFile = File.createTempFile(upload.getClientFileName(), "");                       
                        String tmpDir = System.getProperty("java.io.tmpdir");
                        tempFile = new File(tmpDir, upload.getClientFileName());
                        if (tempFile.exists())
                            tempFile.delete();
                        FileOutputStream fos = new FileOutputStream(tempFile);
                        drain(warStream, fos);
                        fos.close();
                       
                        UploadPortletApp.this.dm.deploy(tempFile);
                        feedback.info("Deployed 1 portlet application to server: " + upload.getClientFileName());
                        app.getServiceLocator().getAuditActivity().logAdminRegistryActivity(
                                app.getUserPrincipalName(), app.getIPAddress(), AuditActivity.REGISTRY_DEPLOY, ApplicationsListHome.PORTLET_REGISTRY_MANAGER);                                                   
                    }
                    catch (Exception e)
                    {
                        String msg = "Failed to upload document: " + upload.getClientFileName();
                        log.error(msg, e);
                        feedback.error(msg);
                    }
                    finally
                    {
                        if (tempFile != null)
                        {
                            tempFile.delete();
                        }
                        if (warStream != null)
                        {
                            try
                            {
                                warStream.close();
                            }
                            catch (IOException e)
                            {
                            }
                        }
                    }
                }
            }
        });
        form.add(new Button("cancelPage", new ResourceModel("pam.details.action.cancel"))
        {
            /*
             * (non-Javadoc)
             * @see org.apache.wicket.markup.html.form.Button#onSubmit()
             */
 
View Full Code Here

                                              // ResourceModel("user.login.expires.expired"));
            expiredFlagChoices.add("Extend");// new
                                             // ResourceModel("user.login.expires.extend"));
            expiredFlagChoices.add("Unlimited");// new
                                                // ResourceModel("user.login.expires.unlimited"));
            form.add(new Button("submitForm",
                    new ResourceModel("common.update")));
            form.add(userExpiredFlagField);
            add(form);
        }
View Full Code Here

TOP

Related Classes of org.apache.wicket.markup.html.form.Button

Copyright © 2018 www.massapicom. 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.