]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - security/plugins/org.argeo.security.ui.admin/src/main/java/org/argeo/security/ui/admin/editors/DefaultUserMainPage.java
First working remote node
[lgpl/argeo-commons.git] / security / plugins / org.argeo.security.ui.admin / src / main / java / org / argeo / security / ui / admin / editors / DefaultUserMainPage.java
index 22927bd1126c6713f9a30ba705ad5a28ee69cba7..5a20377cabce94977ba7e811a62ef94cfa291bfb 100644 (file)
@@ -46,9 +46,8 @@ public class DefaultUserMainPage extends FormPage implements ArgeoNames {
        protected void createFormContent(final IManagedForm mf) {
                try {
                        ScrolledForm form = mf.getForm();
-                       form.setText(userProfile.getProperty(ARGEO_FIRST_NAME).getString()
-                                       + " "
-                                       + userProfile.getProperty(ARGEO_LAST_NAME).getString());
+                       form.setText(getProperty(ARGEO_FIRST_NAME) + " "
+                                       + getProperty(ARGEO_LAST_NAME));
                        GridLayout mainLayout = new GridLayout(1, true);
                        // ColumnLayout mainLayout = new ColumnLayout();
                        // mainLayout.minNumColumns = 1;
@@ -89,13 +88,13 @@ public class DefaultUserMainPage extends FormPage implements ArgeoNames {
                // username = createLT(body, "Username", "");
                // }
                final Text firstName = createLT(body, "First name",
-                               userProfile.getProperty(ARGEO_FIRST_NAME));
+                               getProperty(ARGEO_FIRST_NAME));
                final Text lastName = createLT(body, "Last name",
-                               userProfile.getProperty(ARGEO_LAST_NAME));
+                               getProperty(ARGEO_LAST_NAME));
                final Text email = createLT(body, "Email",
-                               userProfile.getProperty(ARGEO_PRIMARY_EMAIL));
+                               getProperty(ARGEO_PRIMARY_EMAIL));
                final Text description = createLT(body, "Description",
-                               userProfile.getProperty(Property.JCR_DESCRIPTION));
+                               getProperty(Property.JCR_DESCRIPTION));
 
                // create form part (controller)
                AbstractFormPart part = new SectionPart(section) {
@@ -136,6 +135,12 @@ public class DefaultUserMainPage extends FormPage implements ArgeoNames {
                getManagedForm().addPart(part);
        }
 
+       /** @return the property, or teh empty string if not set */
+       protected String getProperty(String name) throws RepositoryException {
+               return userProfile.hasProperty(name) ? userProfile.getProperty(name)
+                               .getString() : "";
+       }
+
        /** Creates the password section */
        protected void createPassworPart(Composite parent) {
                FormToolkit tk = getManagedForm().getToolkit();
@@ -187,11 +192,6 @@ public class DefaultUserMainPage extends FormPage implements ArgeoNames {
                return text;
        }
 
-       protected Text createLT(Composite body, String label, Property value)
-                       throws RepositoryException {
-               return createLT(body, label, value.getString());
-       }
-
        /** Creates label and password. */
        protected Text createLP(Composite body, String label, String value) {
                FormToolkit toolkit = getManagedForm().getToolkit();