Skip to content

Commit

Permalink
UIInput version is now renamed to xxxVersion to be reused in multiple…
Browse files Browse the repository at this point in the history
… wizard steps in shell
  • Loading branch information
gastaldi committed Sep 24, 2013
1 parent 0764bcc commit 88e0c0d
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ public Metadata getMetadata(UIContext context)

@Inject
@WithAttributes(required = true, label = "EJB Version")
private UISelectOne<EJBFacet> version;
private UISelectOne<EJBFacet> ejbVersion;

@Override
public void initializeUI(UIBuilder builder) throws Exception
{
version.setItemLabelConverter(new Converter<EJBFacet, String>()
ejbVersion.setItemLabelConverter(new Converter<EJBFacet, String>()
{
@Override
public String convert(EJBFacet source)
Expand All @@ -62,21 +62,21 @@ public String convert(EJBFacet source)
}
});

for (EJBFacet choice : version.getValueChoices())
for (EJBFacet choice : ejbVersion.getValueChoices())
{
if (version.getValue() == null || choice.getSpecVersion().compareTo(version.getValue().getSpecVersion()) >= 1)
if (ejbVersion.getValue() == null || choice.getSpecVersion().compareTo(ejbVersion.getValue().getSpecVersion()) >= 1)
{
version.setDefaultValue(choice);
ejbVersion.setDefaultValue(choice);
}
}

builder.add(version);
builder.add(ejbVersion);
}

@Override
public Result execute(final UIContext context) throws Exception
{
if (facetFactory.install(getSelectedProject(context), version.getValue()))
if (facetFactory.install(getSelectedProject(context), ejbVersion.getValue()))
{
return Results.success("EJB has been installed.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ public Metadata getMetadata(UIContext context)

@Inject
@WithAttributes(required = true, label = "JavaServer Faces Version")
private UISelectOne<FacesFacet> version;
private UISelectOne<FacesFacet> facesVersion;

@Override
public void initializeUI(UIBuilder builder) throws Exception
{
version.setItemLabelConverter(new Converter<FacesFacet, String>()
facesVersion.setItemLabelConverter(new Converter<FacesFacet, String>()
{
@Override
public String convert(FacesFacet source)
Expand All @@ -63,21 +63,21 @@ public String convert(FacesFacet source)
}
});

for (FacesFacet choice : version.getValueChoices())
for (FacesFacet choice : facesVersion.getValueChoices())
{
if (version.getValue() == null || choice.getSpecVersion().compareTo(version.getValue().getSpecVersion()) >= 1)
if (facesVersion.getValue() == null || choice.getSpecVersion().compareTo(facesVersion.getValue().getSpecVersion()) >= 1)
{
version.setDefaultValue(choice);
facesVersion.setDefaultValue(choice);
}
}

builder.add(version);
builder.add(facesVersion);
}

@Override
public Result execute(final UIContext context) throws Exception
{
if (facetFactory.install(getSelectedProject(context), version.getValue()))
if (facetFactory.install(getSelectedProject(context), facesVersion.getValue()))
{
return Results.success("JavaServer Faces has been installed.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Licensed under the Eclipse Public License version 1.0, available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.jboss.forge.addon.javaee.rest.generator;
package org.jboss.forge.addon.javaee.rest.generator.impl;

import java.util.Arrays;
import java.util.HashMap;
Expand All @@ -16,6 +16,8 @@

import org.jboss.forge.addon.javaee.rest.generation.RestGenerationContext;
import org.jboss.forge.addon.javaee.rest.generation.RestResourceGenerator;
import org.jboss.forge.addon.javaee.rest.generator.FreemarkerTemplateProcessor;
import org.jboss.forge.addon.javaee.rest.generator.ResourceGeneratorUtil;
import org.jboss.forge.addon.parser.java.facets.JavaSourceFacet;
import org.jboss.forge.addon.projects.Project;
import org.jboss.forge.parser.JavaParser;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import org.jboss.forge.addon.javaee.ejb.ui.EJBSetupWizard;
import org.jboss.forge.addon.javaee.jpa.PersistenceFacet;
import org.jboss.forge.addon.javaee.rest.generation.RestResourceGenerator;
import org.jboss.forge.addon.javaee.rest.generator.EntityBasedResourceGenerator;
import org.jboss.forge.addon.javaee.rest.generator.RestGenerationContextImpl;
import org.jboss.forge.addon.javaee.rest.generator.impl.EntityBasedResourceGenerator;
import org.jboss.forge.addon.javaee.ui.AbstractJavaEECommand;
import org.jboss.forge.addon.parser.java.facets.JavaSourceFacet;
import org.jboss.forge.addon.parser.java.resources.JavaResource;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public Metadata getMetadata(UIContext context)

@Inject
@WithAttributes(required = true, label = "JAX-RS Version")
private UISelectOne<RestFacet> version;
private UISelectOne<RestFacet> jaxrsVersion;

@Inject
@WithAttributes(required = true, label = "Configuration Strategy", type = InputType.RADIO)
Expand All @@ -76,7 +76,7 @@ public void initializeUI(UIBuilder builder) throws Exception
{
configureVersions();
configureActivationStrategy(builder.getUIContext());
builder.add(version).add(applicationPath).add(config).add(packageName).add(className);
builder.add(jaxrsVersion).add(applicationPath).add(config).add(packageName).add(className);
}

private void configureActivationStrategy(UIContext context)
Expand Down Expand Up @@ -109,7 +109,7 @@ public String convert(RestActivatorType source)

private void configureVersions()
{
version.setItemLabelConverter(new Converter<RestFacet, String>()
jaxrsVersion.setItemLabelConverter(new Converter<RestFacet, String>()
{
@Override
public String convert(RestFacet source)
Expand All @@ -118,12 +118,12 @@ public String convert(RestFacet source)
}
});

for (RestFacet choice : version.getValueChoices())
for (RestFacet choice : jaxrsVersion.getValueChoices())
{
if (version.getValue() == null
|| choice.getSpecVersion().compareTo(version.getValue().getSpecVersion()) >= 1)
if (jaxrsVersion.getValue() == null
|| choice.getSpecVersion().compareTo(jaxrsVersion.getValue().getSpecVersion()) >= 1)
{
version.setDefaultValue(choice);
jaxrsVersion.setDefaultValue(choice);
}
}
}
Expand All @@ -137,7 +137,7 @@ public void validate(UIValidationContext validator)
@Override
public Result execute(final UIContext context) throws Exception
{
RestFacet facet = version.getValue();
RestFacet facet = jaxrsVersion.getValue();
if (facetFactory.install(getSelectedProject(context), facet))
{
String path = applicationPath.getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,35 +48,35 @@ public Metadata getMetadata(UIContext context)

@Inject
@WithAttributes(required = true, label = "Servlet Version")
private UISelectOne<ServletFacet> choices;
private UISelectOne<ServletFacet<?>> servletVersion;

@Override
public void initializeUI(UIBuilder builder) throws Exception
{
choices.setItemLabelConverter(new Converter<ServletFacet, String>()
servletVersion.setItemLabelConverter(new Converter<ServletFacet<?>, String>()
{
@Override
public String convert(ServletFacet source)
public String convert(ServletFacet<?> source)
{
return source.getSpecVersion().toString();
}
});

for (ServletFacet choice : choices.getValueChoices())
for (ServletFacet<?> choice : servletVersion.getValueChoices())
{
if (choices.getValue() == null || choice.getSpecVersion().compareTo(choices.getValue().getSpecVersion()) >= 1)
if (servletVersion.getValue() == null || choice.getSpecVersion().compareTo(servletVersion.getValue().getSpecVersion()) >= 1)
{
choices.setDefaultValue(choice);
servletVersion.setDefaultValue(choice);
}
}

builder.add(choices);
builder.add(servletVersion);
}

@Override
public Result execute(final UIContext context) throws Exception
{
if (facetFactory.install(getSelectedProject(context), choices.getValue()))
if (facetFactory.install(getSelectedProject(context), servletVersion.getValue()))
{
return Results.success("Servlet API has been installed.");
}
Expand Down

0 comments on commit 88e0c0d

Please sign in to comment.