Package org.apache.wicket.model

Examples of org.apache.wicket.model.PropertyModel


    @Override
    public void buildItems(Fragment fragment, final LocalizedFieldBean field)
    {
        JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
        fragment.add(new TextField<String>("name", new PropertyModel(new LocalizedFieldBeanModel(locator, paNodeBean, field), "name")));
        fragment.add(new TextField<String>("locale", new PropertyModel(new LocalizedFieldBeanModel(locator, paNodeBean, field), "localeString")));
        fragment.add(new TextField<String>("value", new PropertyModel(new LocalizedFieldBeanModel(locator, paNodeBean, field), "value")));
    }
View Full Code Here


            this.associationType = AssociationType;
            associationName = AssociationType.getAssociationName();
            final String assoctionName = AssociationType.getAssociationName();
            refreshList();
            ListView commentListView = new ListView("comments",
                    new PropertyModel(this, "associations"))
            {

                public void populateItem(final ListItem listItem)
                {
                    final JetspeedPrincipal principal = (JetspeedPrincipal) listItem
                            .getModelObject();
                    listItem.add(new Label("Name", principal.getName()));
                    Link deleteLink = new Link("delete")
                    {

                        @Override
                        public void onClick()
                        {
                            try
                            {
                                if (!associationsFrom)
                                {
                                    getManager().removeAssociation(principal,
                                            getPrincipal(), assoctionName);
                                } else
                                {
                                    getManager().removeAssociation(
                                            getPrincipal(), principal,
                                            assoctionName);
                                }
                                refreshList();
                            } catch (Exception e)
                            {
                                // TODO: handle exception
                            }
                        }
                    };
                    deleteLink.add(new Label("deleteLabel", new ResourceModel(
                            "common.delete")));
                    listItem.add(deleteLink);
                }
            };
            if(AssociationType.getFromPrincipalType().equals(principalType))
            {
                add(new Label("principalReleation",new ResourceModel(AssociationType.getToPrincipalType().getName())));   
            }else{
                add(new Label("principalReleation",new ResourceModel(AssociationType.getFromPrincipalType().getName())));
            }
            add(commentListView);
            add(new FeedbackPanel("feedback"));
            Form assocationsForm = new Form("assocationsForm");
            add(assocationsForm);
            DropDownChoice dropDown = new DropDownChoice(
                    "associationPrincipal", new PropertyModel(this,
                            "associationPrincipal"), getNames(),
                    new ChoiceRenderer("name", "name"));
            dropDown.setRequired(true);
            assocationsForm.add(dropDown);
            Button addRelations = new Button("addRelations", new ResourceModel(
View Full Code Here

    public RemotePortletAppDeployer()
    {
        deployer = new JetspeedPortletDeployer();
        Form form = new Form("form");
        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()
            {

            }
        };

        form.add(selectButton);
        add(form);

        IModel getRepo = new LoadableDetachableModel()
        {

            protected Object load()
            {
                return getRepo();
            }
        };

        final PageableListView listview = new PageableListView("repositories",
                getRepo, 10)
        {

            private static final long serialVersionUID = 1L;

            // This method is called for each 'entry' in the list.
            @Override
            protected void populateItem(final ListItem item)
            {
                final PortletApplication application = (PortletApplication) item
                        .getModelObject();
                item.add(new Label("groupId", application.getGroupId()));
                item.add(new Label("artifactId", application.getArtifactId()));
                item.add(new Label("name", application.getName()));
                item.add(new Label("version", application.getVersion()));
                item.add(new Label("type", application.getPackaging()));
                Link actionLink = new Link("action", item.getModel())
                {

                    public void onClick()
                    {
                        PortletApplication portletApplication = (PortletApplication) getModelObject();
                        deployer.deploy(portletApplication, getServiceLocator()
                                .getDeploymentManager());
                    }
                };
                actionLink.setVisibilityAllowed(true);
                actionLink.setOutputMarkupId(true);
                if(deployer.getStatus() == PortletDeployer.DEPLOYING)
                {
                    actionLink.setVisible(false);
                }               
                item.add(actionLink);
            }
        };
        listview.setOutputMarkupId(true);
        final WebMarkupContainer tableGroup = new WebMarkupContainer("tableGroup");
        tableGroup.setOutputMarkupId(true);
        //tableGroup.add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(5)));
        tableGroup.add(new PagingNavigator("navigator", listview));
        tableGroup.add(listview);
        final MultiLineLabel statusLabel = new MultiLineLabel("status",
                new PropertyModel(this, "message"));
        statusLabel.setOutputMarkupId(true);
        final Label tickerLabel =new Label("ticker",new PropertyModel(this,"ticker"));
        tickerLabel.setOutputMarkupId(true);
        add(new AbstractAjaxTimerBehavior(Duration.seconds(3))
        {
            protected void onTimer(AjaxRequestTarget target)
            {
View Full Code Here

            setMultiPart(true);

            add(new Label("importHeader", new ResourceModel("import.header")));

            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
                public boolean isVisible()
                {
                    return (errorMessage != null);
                }
            }).setVisibilityAllowed(true));

            add((new Label("importInfoMessage", new PropertyModel(this, "infoMessage"))
            {

                @Override
                public boolean isVisible()
                {
View Full Code Here

            feedback.setOutputMarkupId(true);
            add(feedback);
            final Form repoFrom = new Form("repoForm");
            repoFrom.add(new Label("repoName", "Repository Name"));
            repoFrom.add(new Label("repoUrl", "Repository URL"));
            repoFrom.add(new TextField("repoNameText", new PropertyModel(this,
                    "repoName")).setRequired(true));
            repoFrom.add(new TextField("repoUrlText", new PropertyModel(this,
                    "repoUrl")).setRequired(true));
            repoFrom.add(new AjaxButton("save", repoFrom)
            {

                @Override
View Full Code Here

            super(name);
            if (appRows > 0)
                this.appRows = appRows;
            if (portletRows > 0)
                this.portletRows = portletRows;
            add(new TextField("appRows", new PropertyModel(this, "appRows"), Integer.class).setRequired(true).add(new RangeValidator(1,1000)));
            add(new TextField("portletRows", new PropertyModel(this, "portletRows"), Integer.class).setRequired(true).add(new RangeValidator(1,1000)));
            add(new Button("editModeSaveButton", new ResourceModel("pam.details.action.save"))
            {
                @Override
                public void onSubmit()
                {
View Full Code Here

            add(new FeedbackPanel("feedback"));
            userAttrsForm.add(new Label("attrNameLabel",new ResourceModel("common.name")));
            userAttrsForm.add(new Label("attrValueLabel",new ResourceModel("common.value")));
            add(userAttrsForm);
            PageableListView usersList = new PageableListView(
                    "attributeEntries", new PropertyModel(this,
                            "userAttributes"), 10)
            {

                protected void populateItem(ListItem item)
                {
                    final Map<String, SecurityAttribute> attributes = (Map<String, SecurityAttribute>) item
                            .getModelObject();
                    final SecurityAttribute attrib = attributes.get("value");
                    item.add(new TextField("name", new Model(attrib.getName()))
                    {

                        @Override
                        public boolean isEnabled()
                        {
                            return !attrib.isReadOnly();
                        }
                    });
                    item.add(new TextField("value", new PropertyModel<String>(attrib,"stringValue"))
                    {

                        @Override
                        public boolean isEnabled()
                        {
                            return !attrib.isReadOnly();
                        }
                    });
                    if (!attrib.isReadOnly())
                    {
                        Link deleteLink = new Link("link", item.getModel())
                        {

                            @Override
                            public void onClick()
                            {
                                try
                                {
                                    getPrincipal().getSecurityAttributes()
                                            .removeAttribute(attrib.getName());
                                    getManager()
                                            .updatePrincipal(getPrincipal());
                                }
                                catch (SecurityException e)
                                {
                                    log.error("Failed to update principal.", e);
                                }
                                setPrincipal(getPrincipal());
                                refreshData();
                            }
                        };
                        deleteLink.add(new Label("deleteLabel",
                                new ResourceModel("common.delete")));
                        item.add(deleteLink);
                    }
                }
            };
            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

    @Override
    public void buildItems(Fragment fragment, final DescriptionBean descriptionBean)
    {
        JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
        fragment.add(new TextField<String>("locale", new PropertyModel(new DescriptionBeanModel(locator, paNodeBean, type, name, descriptionBean), "localeString")));
        fragment.add(new TextField<String>("description", new PropertyModel(new DescriptionBeanModel(locator, paNodeBean, type, name, descriptionBean), "description")));
    }
View Full Code Here

        protected PrincipalProfilePanel(String id)
        {
            super(id);
            Form profileForm = new Form("profileForm");
            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")){
View Full Code Here

        {
            super(name);
            // set this form to multipart mode (allways needed for uploads!)
            setMultiPart(true);
            // Add one file input field
            add(new FileUploadField("fileInput", new PropertyModel(UploadPortletApp.this, "fileUploadField")));
        }
View Full Code Here

TOP

Related Classes of org.apache.wicket.model.PropertyModel

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.