Skip to content

Commit

Permalink
Fixed compilation errors in refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Feb 5, 2013
1 parent 9738c04 commit 59272ff
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
13 changes: 7 additions & 6 deletions aesh/src/main/java/org/jboss/forge/aesh/ShellContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.jboss.forge.ui.UIBuilder;
import org.jboss.forge.ui.UIContext;
import org.jboss.forge.ui.UIInput;
import org.jboss.forge.ui.UIInputComponent;
import org.jboss.forge.ui.UISelection;
import org.jboss.forge.ui.UIValidationContext;

Expand All @@ -22,7 +23,7 @@ public class ShellContext implements UIValidationContext, UIContext, UIBuilder
{

private boolean standalone = false;
private List<UIInput<?>> inputs = new ArrayList<UIInput<?>>();
private List<UIInputComponent<?, ?>> inputs = new ArrayList<UIInputComponent<?, ?>>();

public ShellContext()
{
Expand All @@ -39,20 +40,20 @@ public void setStandalone(boolean standalone)
}

@Override
public UIBuilder add(UIInput<?> input)
public UIBuilder add(UIInputComponent<?, ?> input)
{
inputs.add(input);
return this;
}

public List<UIInput<?>> getInputs()
public List<UIInputComponent<?, ?>> getInputs()
{
return inputs;
}

public UIInput<?> findInput(String name)
public UIInputComponent<?, ?> findInput(String name)
{
for (UIInput<?> input : inputs)
for (UIInputComponent<?, ?> input : inputs)
{
if (input.getName().equals(name))
return input;
Expand All @@ -61,7 +62,7 @@ public UIInput<?> findInput(String name)
}

@Override
public void addValidationError(UIInput<?> input, String errorMessage)
public void addValidationError(UIInputComponent<?, ?> input, String errorMessage)
{
// TODO: ignoring errorMessage for now
inputs.add(input);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.jboss.forge.aesh.ShellContext;
import org.jboss.forge.ui.UICommand;
import org.jboss.forge.ui.UIInput;
import org.jboss.forge.ui.UIInputComponent;

/**
* @author <a href="mailto:stale.pedersen@jboss.org">Ståle W. Pedersen</a>
Expand All @@ -26,7 +27,7 @@ public static CommandLineParser generateParser(UICommand command, ShellContext c

ParameterInt parameter =
new ParameterInt(command.getMetadata().getName(), command.getMetadata().getDescription());
for(UIInput<?> input : context.getInputs()) {
for(UIInputComponent<?, ?> input : context.getInputs()) {
if(input.getValueType() == Boolean.class) {
parameter.addOption(
new OptionBuilder().name(input.getName().charAt(0)).
Expand All @@ -43,7 +44,7 @@ public static CommandLineParser generateParser(UICommand command, ShellContext c
}

public static void populateUIInputs(CommandLine commandLine, ShellContext context) {
for(UIInput<?> input : context.getInputs()) {
for(UIInputComponent<?, ?> input : context.getInputs()) {
//String value;
//if((value = commandLine.getOptionValue(input.getName())) != null)
if(commandLine.hasOption(input.getName())) {
Expand All @@ -63,7 +64,7 @@ public static void populateUIInputs(CommandLine commandLine, ShellContext contex
}

@SuppressWarnings({ "unchecked" })
private static void setInputValue(UIInput<?> input, String value) {
private static void setInputValue(UIInputComponent<?, ?> input, String value) {

if(input.getValueType() == String.class) {
((UIInput<String>) input).setValue(value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.jboss.forge.resource.DirectoryResource;
import org.jboss.forge.ui.UIBuilder;
import org.jboss.forge.ui.UIContext;
import org.jboss.forge.ui.UIInput;
import org.jboss.forge.ui.UIInputComponent;
import org.jboss.forge.ui.UISelection;
import org.jboss.forge.ui.UIValidationContext;
import org.jboss.shrinkwrap.api.ArchivePaths;
Expand Down Expand Up @@ -65,12 +65,12 @@ public void testInjectionNotNull()
@Test
public void testInvokeCommand() throws Exception
{
final List<UIInput<?>> inputs = new ArrayList<UIInput<?>>();
final List<UIInputComponent<?, ?>> inputs = new ArrayList<UIInputComponent<?, ?>>();

final UIBuilder builder = new UIBuilder()
{
@Override
public UIBuilder add(UIInput<?> input)
public UIBuilder add(UIInputComponent<?, ?> input)
{
inputs.add(input);
return this;
Expand Down Expand Up @@ -104,7 +104,7 @@ public UIBuilder getUIBuilder()
}

@Override
public void addValidationError(UIInput<?> input, String errorMessage)
public void addValidationError(UIInputComponent<?, ?> input, String errorMessage)
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@

public interface UIValidationContext extends UIContext
{
public void addValidationError(UIInput<?> input, String errorMessage);
public void addValidationError(UIInputComponent<?, ?> input, String errorMessage);
}

0 comments on commit 59272ff

Please sign in to comment.