Package org.apache.wicket.markup.html.basic

Examples of org.apache.wicket.markup.html.basic.Label


        role = request.getPreferences().getValue(JetspeedPrincipalManagementPortlet.DEFAULT_ROLE, "");
        templateDir = request.getPreferences().getValue(JetspeedPrincipalManagementPortlet.NEW_USER_TEMPLATE_DIR, "");
        subSiteRoot = request.getPreferences().getValue(JetspeedPrincipalManagementPortlet.SUB_SITE_ROOT, "");
        add(new FeedbackPanel("feedback"));
        Form userPrefernces = new Form("userPrefernces");
        userPrefernces.add(new Label("subsiterootLabel", new ResourceModel("subsiteroot")));
        userPrefernces.add(new TextField("subsiteroot", new PropertyModel(this, "subSiteRoot")));       
        userPrefernces.add(new Label("subsiteLabel", new ResourceModel("default.subsite")));
        userPrefernces.add(new DropDownChoice("defaultSubSite", new PropertyModel(this, "subite"),getSubSites));
        userPrefernces.add(new Label("templateDirLabel", new ResourceModel("templatedir")));
        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()
View Full Code Here


        public PrincipalAttributesPanel(String id)
        {
            super(id);
            Form userAttrsForm = new Form("userAttrsForm");
            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(
View Full Code Here

            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")){
                @Override
                public void onSubmit()
View Full Code Here

                }
            };
            PasswordTextField credentialValueField = new PasswordTextField(
                    "credentialValue", new PropertyModel(this,
                            "credentialValue"));
            form.add(new Label("passwordLabel", new ResourceModel(
                    "user.login.password")));
            credentialValueField.setRequired(false);
            form.add(credentialValueField);
            CheckBox credentialUpdateRequiredField = new CheckBox(
                    "credentialUpdateRequired", new PropertyModel(this,
                            "credentialUpdateRequired"));
            form.add(new Label("changerequiredLabel", new ResourceModel(
                    "user.change.required")));
            form.add(credentialUpdateRequiredField);
            Label lastAuthenticationDateLabel = new Label(
                    "lastAuthenticationDate", new PropertyModel(this,
                            "lastAuthenticationDate"));
            form.add(new Label("lastLogonLabel", new ResourceModel(
                    "user.login.last.logon")));
            form.add(lastAuthenticationDateLabel);
            CheckBox credentialEnabledField = new CheckBox("credentialEnabled",
                    new PropertyModel(this, "credentialEnabled"));
            form.add(new Label("enabledLabel", new ResourceModel(
                    "common.enabled")));
            form.add(credentialEnabledField);
            Label credentialExpirationDateLabel = new Label(
                    "credentialExpirationDate", new PropertyModel(this,
                            "credentialExpirationDate"));
            form.add(new Label("expiresLabel", new ResourceModel(
                    "user.login.expires")));
            form.add(credentialExpirationDateLabel);
            List expiredFlagChoices = new ArrayList();
            RadioChoice userExpiredFlagField = new RadioChoice(
                    "userExpiredFlag", new PropertyModel(this,
View Full Code Here

            }
            Form profileForm = new Form("profileForm");
            add(profileForm);
            profileForm.add(new CheckBox("userEnabled", 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()
                {
                    try
                    {
                        getPrincipal().setEnabled(isUserEnabled());
                        getManager().updatePrincipal(principal);
                        setPrincipal(principal);
                        principalDataProvider.refresh(getManager(),getRoleManager(),getSearchString());
                    }
                    catch (SecurityException jSx)
                    {
                        log.error("Failed to update principal.", jSx);
                    }
                }
               
            });
            profileForm.add(new Button("remove", new ResourceModel(principalParam + ".remove.button")){

                @Override
                public void onSubmit()
                {
                    try
                    {
                        getManager().removePrincipal(principal.getName());
                        setPrincipal(null);
                        controlPannels(false);
                        principalDataProvider.refresh(getManager(),getRoleManager(),getSearchString());
                    }
                    catch (SecurityException e)
                    {
                        error(e.getMessage());
                    }
                }
               
            }.add(new JavascriptEventConfirmation("onclick",new ResourceModel("action.delete.confirm"))));           
            Form userRulesForm = new Form("userRulesForm")
            {

                protected void onSubmit()
                {
                    try
                    {
                        Collection rules = getServiceLocator().getProfiler()
                                .getRulesForPrincipal(getPrincipal());
                        for (Iterator it = getUserRules().iterator(); it
                                .hasNext();)
                        {
                            Map ruleMap = (Map) it.next();
                            if (Boolean.TRUE.equals(ruleMap.get("checked")))
                            {
                                String locatorName = ((PrincipalRule) ruleMap
                                        .get("rule")).getLocatorName();
                                for (Iterator ruleIter = rules.iterator(); ruleIter
                                        .hasNext();)
                                {
                                    PrincipalRule rule = (PrincipalRule) ruleIter
                                            .next();
                                    if (rule.getLocatorName().equals(
                                            locatorName))
                                    {
                                        getServiceLocator().getProfiler()
                                                .deletePrincipalRule(rule);
                                        getServiceLocator()
                                                .getAuditActivity()
                                                .logAdminAuthorizationActivity(
                                                        getPortletRequest()
                                                                .getUserPrincipal()
                                                                .getName(),
                                                        getIPAddress(),
                                                        getSelectedPrincipal(),
                                                        AuditActivity.USER_DELETE_PROFILE,
                                                        rule.getProfilingRule()
                                                                .getId()
                                                                + "-"
                                                                + rule
                                                                        .getLocatorName(),
                                                        AdminPortletWebPage.USER_ADMINISTRATION);
                                    }
                                }
                            }
                        }
                    } catch (Exception e)
                    {
                        error(e.getMessage());
                    }
                    refreshData();
                }
            };
            SortableDataProvider dataProvider = new SortableDataProvider()
            {

                public int size()
                {
                    return getUserRules().size();
                }

                public IModel model(Object object)
                {
                    Map ruleMap = (Map) object;
                    return new Model((Serializable) ruleMap);
                }

                public Iterator iterator(int first, int count)
                {
                    return getUserRules().subList(first, first + count)
                            .iterator();
                }
            };
            IColumn[] columns =
            {
                    new CheckBoxPropertyColumn(new Model(" "), "checked"),
                    new PropertyColumn(new ResourceModel("user.ruleName"),
                            "rule.locatorName"),
                    new PropertyColumn(new ResourceModel("user.ruleValue"),
                            "rule.profilingRule")};
            DataTable userRulesDataTable = new DataTable("entries", columns,
                    dataProvider, 10)
            {

                protected Item newRowItem(String id, int index, IModel model)
                {
                    return new PortletOddEvenItem(id, index, model);
                }
            };
            userRulesDataTable.addTopToolbar(new HeadersToolbar(
                    userRulesDataTable, dataProvider));
            userRulesDataTable.addBottomToolbar(new NavigationToolbar(
                    userRulesDataTable));
            userRulesForm.add(userRulesDataTable);
            userRulesForm.add(new Button("submit", new ResourceModel(
                    "common.delete")));
            add(userRulesForm);
            Form addRuleForm = new Form("addRuleForm")
            {

                protected void onSubmit()
                {
                    String locatorName = getLocatorName();
                    if (locatorName != null && locatorName.trim().length() > 0)
                    {
                        try
                        {
                            String ruleName = getRuleName();
                            Profiler profiler = getServiceLocator().getProfiler();
                            ProfilingRule profilingRule = profiler.getRule(ruleName);
                            if (profilingRule != null)
                            {
                                profiler.setRuleForPrincipal(getPrincipal(), profilingRule, locatorName);
                            }
                            else
                            {
                                log.error("Failed to set profiling rule for the principal. Invalid profiling rule: " + ruleName);
                            }
                            getServiceLocator()
                                    .getAuditActivity()
                                    .logAdminAuthorizationActivity(
                                            getPortletRequest()
                                                    .getUserPrincipal()
                                                    .getName(),
                                            getIPAddress(),
                                            getSelectedPrincipal(),
                                            AuditActivity.USER_ADD_PROFILE,
                                            ruleName + "-" + locatorName,
                                            AdminPortletWebPage.USER_ADMINISTRATION);
                        } catch (Exception e)
                        {
                            error(e.getMessage());
                        }
                        refreshData();
                    }
                }
            };
            addRuleForm.add(new Label("userruleNamelabel", new ResourceModel(
                    "user.ruleName")));
            addRuleForm.add(new Label("userruledesclabel", new ResourceModel(
                    "user.rule.desc")));
            RequiredTextField locatorNameField = new RequiredTextField(
                    "locatorName", new PropertyModel(this, "locatorName"));
            addRuleForm.add(locatorNameField);
            addRuleForm.add(new Label("userrulelabel", new ResourceModel(
                    "user.ruleValue")));
            DropDownChoice ruleNameField = new DropDownChoice("ruleName",
                    new PropertyModel(this, "ruleName"), getFullRules());
            addRuleForm.add(ruleNameField);
            addRuleForm.add(new Button("addRule", new ResourceModel(
View Full Code Here

            if (labelModel == null)
            {
                tmpLabelModel = createLabelModel(model);
            }

            link.add(new Label("label", tmpLabelModel));
        }
View Full Code Here

    class ActionPanel extends Panel
    {
        public ActionPanel(String id, IModel model, Link link, String propertyExpression)
        {
            super(id, model);
            link.add(new Label("label", new PropertyModel(model.getObject(), propertyExpression)));
            add(link);
        }
View Full Code Here

            Form ruleEditForm = new Form("ruleEditForm");
           
            FeedbackPanel feedbackPanel = new FeedbackPanel("feedbackPanel");
            ruleEditForm.add(feedbackPanel);
           
            ruleEditForm.add(new Label("ruleIdLabel", new ResourceModel("profiler.rule.id")));
            ruleEditForm.add(new Label("ruleTitleLabel", new ResourceModel("profiler.rule.title")));
            ruleEditForm.add(new Label("ruleClassLabel", new ResourceModel("profiler.rule.class")));
           
            ruleIdField = new TextField("ruleIdField", new PropertyModel(WicketProfilerAdmin.this, "profilingRule.id"));
            ruleIdField.setRequired(true);           
            ruleIdField.add(new ProfileRuleValidator());
           
            TextField ruleTitleField = new TextField("ruleTitleField", new PropertyModel(WicketProfilerAdmin.this, "profilingRule.title"));
           
            DropDownChoice ruleClassField = new DropDownChoice("ruleClassField", classNames);
            ruleClassField.setModel(new PropertyModel(WicketProfilerAdmin.this, "profilingRule.classname"));
           
            Button ruleSaveButton = new Button("ruleSaveButton", new ResourceModel("profiler.rule.save")) {

                @Override
                public void onSubmit() {
                    Profiler profiler = getServiceLocator().getProfiler();
                    try {
                        profiler.storeProfilingRule(profilingRule);
                        if (!getRules().contains(profilingRule)) {
                            getRules().add(profilingRule);
                        }
                        ruleIdFieldReadOnly(true);
                    } catch (ProfilerException e) {
                        logger.error("Failed to update rule: " + profilingRule, e);
                    }
                }
               
            };

            Button ruleRemoveButton = new Button("ruleRemoveButton", new ResourceModel("profiler.rule.remove")) {

                @Override
                public void onSubmit() {
                    Profiler profiler = getServiceLocator().getProfiler();
                    try {
                        if (getRules().contains(profilingRule)) {
                            getRules().remove(profilingRule);
                        }
                        profiler.deleteProfilingRule(profilingRule);
                        profilingRule = null;
                        RuleEditPanel.this.setVisible(false);
                    } catch (ProfilerException e) {
                        logger.error("Failed to REMOVE: " + profilingRule, e);
                    }
                }
               
            };
           
            ruleEditForm.add(ruleIdField);
            ruleEditForm.add(ruleTitleField);
            ruleEditForm.add(ruleClassField);
            ruleEditForm.add(ruleSaveButton);
            ruleEditForm.add(ruleRemoveButton);

           
            // the list of criteria for the selected rule
           
            ruleEditForm.add(new Label("ruleCriteriaLabel",new ResourceModel("criteria.title")));
           
            SortableDataProvider dataProvider = new SortableDataProvider()
            {
                public int size()
                {
View Full Code Here

            public CriterionEditPanel(String id) {
                super(id);
               
                Form criterionEditForm = new Form("criterionEditForm");

                criterionEditForm.add(new Label("criterionNameLabel", new ResourceModel("criterion.name")));
                criterionEditForm.add(new Label("criterionValueLabel", new ResourceModel("criterion.value")));
                criterionEditForm.add(new Label("criterionResolverTypeLabel", new ResourceModel("criterion.resolver")));
                criterionEditForm.add(new Label("criterionFallbackLabel", new ResourceModel("criterion.fallback.type")));
                criterionEditForm.add(new Label("criterionOrderLabel", new ResourceModel("criterion.fallback.order")));
               
                TextField criterionNameField = new TextField("criterionNameField", new PropertyModel(RuleEditPanel.this, "criterion.name"));
                criterionNameField.setRequired(true);

                TextField criterionValueField = new TextField("criterionValueField", new PropertyModel(RuleEditPanel.this, "criterion.value"));
View Full Code Here

            @Override
            protected void populateItem(Item<KeyVal> item)
            {
                final KeyVal field = item.getModelObject();
                item.add(new Label("name", field.getKey()));
                item.add(new Label("value", field.getValue()).setEscapeModelStrings(false));
            }

            @Override
            protected Iterator<IModel<KeyVal>> getItemModels()
            {
                List<KeyVal> list = (List<KeyVal>) getDefaultModelObject();
                return new ModelIteratorAdapter<KeyVal>(list.iterator())
                {

                    @Override
                    protected IModel<KeyVal> model(KeyVal object)
                    {
                        return new Model<KeyVal>(object);
                    }
                };
            }
        };

        jetspeedSecurityContraintNames = new ArrayList<String>(Arrays.asList(""));
        PageManager pageManager = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPageManager();
        try
        {
            for (Object secConstDefObj : pageManager.getPageSecurity().getSecurityConstraintsDefs())
            {
                SecurityConstraintsDef secConstDef = (SecurityConstraintsDef) secConstDefObj;
                jetspeedSecurityContraintNames.add(secConstDef.getName());
            }
        }
        catch (Exception e)
        {
            logger.error("Failed to retrieve jetspeed security constraint defs from page manager.", e);
        }
       
        jetspeedSecurityConstraint = app.getJetspeedSecurityConstraint();

        Form form = new Form("form");
        form.add(dataRepeater);
        form.add(new DropDownChoice<String>("jetspeedConstraint", new PropertyModel<String>(this, "jetspeedSecurityConstraint"), jetspeedSecurityContraintNames));
        form.add(new Button("jsecSave", new ResourceModel("pam.details.action.save"))
        {
            @Override
            public void onSubmit()
            {
                FeedbackPanel feed = (FeedbackPanel) getPage().get("feedback");
               
                try
                {
                    PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry();
                    PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
                    app.setJetspeedSecurityConstraint("".equals(jetspeedSecurityConstraint) ? null : jetspeedSecurityConstraint);
                    registry.updatePortletApplication(app);
                    StringResourceModel resModel = new StringResourceModel("pam.details.action.status.application.saveOK", this, null, new Object [] { paNodeBean.getApplicationName() } );
                    feed.info(resModel.getString());
                }
                catch (RegistryException e)
                {
                    logger.error("Failed to update jetspeed security constraint defs of application.", e);
                    StringResourceModel resModel = new StringResourceModel("pam.details.action.status.application.saveFailure", this, null, new Object [] { paNodeBean.getApplicationName(), e.getMessage() } );
                    feed.info(resModel.getString());
                }
            }
        });
       
        form.add(new Label("resourceBundle", app.getResourceBundle()));
       
        Button reloadResourceBundlesButton = new Button("reloadResourceBundle", new ResourceModel("pam.details.resource.bundle.reload"))
        {
            @Override
            public void onSubmit()
View Full Code Here

TOP

Related Classes of org.apache.wicket.markup.html.basic.Label

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.