code: public void loadDefaultsFromPortletDefinitionIfNew(PortletDefinitionForm form) {
  
          if (!form.isNew()) {
              // Get out;  we only prepopulate new portlets
              return;
          }
  
          // appName/portletName must be set at this point
          Validate.notBlank(form.getApplicationId(), "ApplicationId not set");
          Validate.notBlank(form.getPortletName(), "PortletName not set");
  
          final PortletRegistryService portletRegistryService =
                  portalDriverContainerServices.getPortletRegistryService();
          final PortletDefinition portletDef;
          try {
              portletDef =
                      portletRegistryService.getPortlet(
                              form.getApplicationId(), form.getPortletName());
          } catch (PortletContainerException e) {
              this.logger.warn(
                      "Failed to load portlet descriptor for appId='"
                              + form.getApplicationId()
                              + "', portletName='"
                              + form.getPortletName()
                              + "'",
                      e);
              return;
          }
  
          form.setTitle(portletDef.getPortletName());
          form.setName(portletDef.getPortletName());
          for (Supports supports : portletDef.getSupports()) {
              for (String mode : supports.getPortletModes()) {
                  if ("edit".equalsIgnoreCase(mode)) {
                      form.setEditable(true);
                  } else if ("help".equalsIgnoreCase(mode)) {
                      form.setHasHelp(true);
                  } else if ("config".equalsIgnoreCase(mode)) {
                      form.setConfigurable(true);
                  }
              }
          }
      }
docs: Pre-populate a new {@link PortletDefinitionForm} with information from the {@link
  PortletDefinition}.
  
  @param form