Examples of UIContext


Examples of org.jboss.forge.addon.ui.context.UIContext

   }

   @Override
   public void initializeUI(UIBuilder builder) throws Exception
   {
      UIContext context = builder.getUIContext();
      ConstraintType constraintType = (ConstraintType) context.getAttributeMap().get(ConstraintType.class);
      generateConstraintInputs(builder, constraintType.getConstraint());
   }
View Full Code Here

Examples of org.jboss.forge.addon.ui.context.UIContext

   }

   @Override
   public Result execute(UIExecutionContext context) throws Exception
   {
      UIContext uiContext = context.getUIContext();
      Map<Object, Object> attributeMap = uiContext.getAttributeMap();
      PropertySource<JavaClassSource> property = (PropertySource<JavaClassSource>) attributeMap
               .get(PropertySource.class);
      ConstraintType constraintType = (ConstraintType) attributeMap.get(ConstraintType.class);
      Boolean onAccessor = (Boolean) attributeMap.get("onAccessor");
      final AnnotationTargetSource<JavaClassSource, ?> annotationTarget;
View Full Code Here

Examples of org.jboss.forge.addon.ui.context.UIContext

   @SuppressWarnings({ "rawtypes", "unchecked" })
   @Override
   public void initializeUI(UIBuilder builder) throws Exception
   {
      UIContext context = builder.getUIContext();
      Project project = getSelectedProject(context);
      JPAFacet<PersistenceCommonDescriptor> persistenceFacet = project.getFacet(JPAFacet.class);
      JavaSourceFacet javaSourceFacet = project.getFacet(JavaSourceFacet.class);
      List<JavaClassSource> allEntities = persistenceFacet.getAllEntities();
      List<JavaClassSource> supportedEntities = new ArrayList<>();
      for (JavaClassSource entity : allEntities)
      {
         if (isEntityWithSimpleKey(entity))
         {
            supportedEntities.add(entity);
         }
      }
      targets.setValueChoices(supportedEntities);
      targets.setItemLabelConverter(new Converter<JavaClassSource, String>()
      {
         @Override
         public String convert(JavaClassSource source)
         {
            return source == null ? null : source.getQualifiedName();
         }
      });
      List<String> persistenceUnits = new ArrayList<>();
      List<PersistenceUnitCommon> allUnits = persistenceFacet.getConfig().getAllPersistenceUnit();
      for (PersistenceUnitCommon persistenceUnit : allUnits)
      {
         persistenceUnits.add(persistenceUnit.getName());
      }
      if (!persistenceUnits.isEmpty())
      {
         persistenceUnit.setValueChoices(persistenceUnits).setDefaultValue(persistenceUnits.get(0));
      }

      // TODO: May detect where @Path resources are located
      packageName.setDefaultValue(javaSourceFacet.getBasePackage() + ".rest");

      contentType.setValueChoices(Arrays.asList(MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML));
      generator.setDefaultValue(defaultResourceGenerator);
      if (context.getProvider().isGUI())
      {
         generator.setItemLabelConverter(new Converter<RestResourceGenerator, String>()
         {
            @Override
            public String convert(RestResourceGenerator source)
View Full Code Here

Examples of org.jboss.forge.addon.ui.context.UIContext

   }

   @Override
   public Result execute(final UIExecutionContext context) throws Exception
   {
      UIContext uiContext = context.getUIContext();
      RestGenerationContext generationContext = createContextFor(uiContext);
      Set<JavaClassSource> endpoints = generateEndpoints(generationContext);
      Project project = generationContext.getProject();
      JavaSourceFacet javaSourceFacet = project.getFacet(JavaSourceFacet.class);
      List<JavaResource> selection = new ArrayList<>();

      for (JavaClassSource javaClass : endpoints)
      {
         selection.add(javaSourceFacet.saveJavaSource(javaClass));
      }
      uiContext.setSelection(selection);
      return Results.success("Endpoint created");
   }
View Full Code Here

Examples of org.jboss.forge.addon.ui.context.UIContext

   private UIInputMany<String> arguments;

   @Override
   public void initializeUI(UIBuilder builder) throws Exception
   {
      UIContext context = builder.getUIContext();
      // Project project = getSelectedProject(context);
      UISelection<Resource<?>> initialSelection = context.getInitialSelection();
      Resource<?> resource = initialSelection.get();
      if (resource instanceof JavaResource)
      {
         enumClass.setDefaultValue((JavaResource) resource);
      }
View Full Code Here

Examples of org.jboss.forge.addon.ui.context.UIContext

   }

   @Override
   public void initializeUI(UIBuilder builder) throws Exception
   {
      final UIContext uiContext = builder.getUIContext();
      PersistenceContainer pc = (PersistenceContainer) uiContext.getAttributeMap().get(PersistenceContainer.class);
      initDBType(uiContext);
      initDatasourceName(uiContext);
      initPersistenceUnitName(builder);
      builder.add(dbType);
      overwritePersistenceUnit.setEnabled(new Callable<Boolean>()
View Full Code Here

Examples of org.jboss.forge.addon.ui.context.UIContext

   }

   @Override
   public void validate(UIValidationContext validator)
   {
      UIContext uiContext = validator.getUIContext();
      JPADataSource ds = getDataSource(uiContext);
      try
      {
         ds.validate();
      }
View Full Code Here

Examples of org.jboss.forge.addon.ui.context.UIContext

   }

   @Override
   public Result execute(UIExecutionContext context) throws Exception
   {
      UIContext uiContext = context.getUIContext();
      Project project = getSelectedProject(uiContext);
      JPADataSource dataSource = getDataSource(uiContext);
      Boolean configureMetadata = (Boolean) uiContext.getAttributeMap().get("ConfigureMetadata");
      String puName = persistenceUnitName.getValue();
      persistenceOperations.setup(puName, project, dataSource, configureMetadata);
      return Results.success("Persistence (JPA) is installed.");

   }
View Full Code Here

Examples of org.jboss.forge.addon.ui.context.UIContext

   private UIInputMany<String> arguments;

   @Override
   public void initializeUI(UIBuilder builder) throws Exception
   {
      UIContext context = builder.getUIContext();
      // Project project = getSelectedProject(context);
      UISelection<Resource<?>> initialSelection = context.getInitialSelection();
      Resource<?> resource = initialSelection.get();
      if (resource instanceof JavaResource)
      {
         enumClass.setDefaultValue((JavaResource) resource);
      }
View Full Code Here

Examples of org.jboss.forge.addon.ui.context.UIContext

            project = projectFactory.createProject(targetDir, buildSystem.getValue());
         }

         if (project != null)
         {
            UIContext uiContext = context.getUIContext();
            MetadataFacet metadataFacet = project.getFacet(MetadataFacet.class);
            metadataFacet.setProjectName(named.getValue());
            metadataFacet.setProjectVersion(version.getValue());
            metadataFacet.setTopLevelPackage(topLevelPackage.getValue());

            if (finalName.hasValue())
            {
               PackagingFacet packagingFacet = project.getFacet(PackagingFacet.class);
               packagingFacet.setFinalName(finalName.getValue());
            }

            uiContext.setSelection(project.getRoot());
            uiContext.getAttributeMap().put(Project.class, project);
         }
         else
            result = Results.fail("Could not create project of type: [" + value + "]");
      }
      else
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.