Skip to content

Commit

Permalink
Added getDocLocation() for UICommandMetadata
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Feb 16, 2013
1 parent b64e59b commit 13cb1b7
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 24 deletions.
10 changes: 10 additions & 0 deletions ui/api/src/main/java/org/jboss/forge/ui/UICommandMetadata.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

package org.jboss.forge.ui;

import java.net.URL;

/**
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*/
Expand All @@ -17,4 +19,12 @@ public interface UICommandMetadata
String getDescription();

UICategory getCategory();

/**
* Returns the location of the documentation of this command
*
* @return null if no documentation was found
*/
URL getDocLocation();

}
Original file line number Diff line number Diff line change
@@ -1,27 +1,39 @@
package org.jboss.forge.ui.base;

import java.net.URL;

import org.jboss.forge.ui.UICategory;
import org.jboss.forge.ui.UICommandMetadata;

public class UICommandMetadataBase implements UICommandMetadata
{
private final String name;
private final String description;
private UICategory category;
private final UICategory category;
private final URL docLocation;

public UICommandMetadataBase(String name, String description)
{
super();
this.name = name;
this.description = description;
this(name, description, null, null);
}

public UICommandMetadataBase(String name, String description, UICategory category)
{
this(name, description, category, null);
}

public UICommandMetadataBase(String name, String description, URL docLocation)
{
this(name, description, null, docLocation);
}

public UICommandMetadataBase(String name, String description, UICategory category, URL docLocation)
{
super();
this.name = name;
this.description = description;
this.category = category;
this.docLocation = docLocation;
}

@Override
Expand All @@ -41,4 +53,10 @@ public UICategory getCategory()
{
return category;
}

@Override
public URL getDocLocation()
{
return docLocation;
}
}
23 changes: 3 additions & 20 deletions ui/tests/src/test/java/org/jboss/forge/ui/MyFirstWizard.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import javax.inject.Inject;

import org.jboss.forge.ui.base.UICommandMetadataBase;
import org.jboss.forge.ui.util.Categories;
import org.jboss.forge.ui.wizard.UIWizard;

Expand Down Expand Up @@ -38,26 +39,8 @@ public Result execute(UIContext context) throws Exception
@Override
public UICommandMetadata getMetadata()
{
return new UICommandMetadata()
{
@Override
public String getName()
{
return MyFirstWizard.class.getName();
}

@Override
public String getDescription()
{
return "generic test wizard";
}

@Override
public UICategory getCategory()
{
return Categories.create("Example");
}
};
return new UICommandMetadataBase(MyFirstWizard.class.getName(), "generic test wizard",
Categories.create("Example"));
}

@Override
Expand Down

0 comments on commit 13cb1b7

Please sign in to comment.