Interface NewResourceHandler
-
- All Known Subinterfaces:
NewWorkspaceProjectHandler
- All Known Implementing Classes:
DefaultNewResourceHandler
public interface NewResourceHandlerDefinition of Handler to support creation of new resources
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidacceptContext(com.google.gwt.core.client.Callback<Boolean,Void> callback)Indicates if the NewResourceHandler can create a resource to this pathbooleancanCreate()Asks if the resource handler can be created or not.voidcreate(org.guvnor.common.services.project.model.Package pkg, String baseFileName, NewResourcePresenter presenter)An entry-point for the creation of the new resourceorg.uberfire.mvp.CommandgetCommand(NewResourcePresenter newResourcePresenter)A command to execute instead of defaulting to the NewResourceView.StringgetDescription()A description of the new resource typeList<org.uberfire.commons.data.Pair<String,? extends com.google.gwt.user.client.ui.IsWidget>>getExtensions()Return a List of Widgets that the NewResourceHandler can use to gather additional parameters for the new resource.com.google.gwt.user.client.ui.IsWidgetgetIcon()An icon representing the new resource typedefault List<org.kie.workbench.common.profile.api.preferences.Profile>getProfiles()Defines the list of profiles where this resource handler should be used.org.uberfire.workbench.type.ResourceTypeDefinitiongetResourceType()Get the ResourceType represented by the Handlerdefault booleanisProjectAsset()Defines whether this resource is a project asset and should appear on the Add Asset screendefault intorder()Defines the handler order for UI purposes.default booleansupportsDefaultPackage()Indicates if the NewResourceHandler can create the assets on the default packagevoidvalidate(String baseFileName, org.uberfire.ext.editor.commons.client.validation.ValidatorWithReasonCallback callback)Provide NewResourceHandlers with the ability to validate additional parameters before the creation of the new resource
-
-
-
Method Detail
-
getDescription
String getDescription()
A description of the new resource type- Returns:
-
getIcon
com.google.gwt.user.client.ui.IsWidget getIcon()
An icon representing the new resource type- Returns:
-
getResourceType
org.uberfire.workbench.type.ResourceTypeDefinition getResourceType()
Get the ResourceType represented by the Handler- Returns:
- resource type
-
canCreate
boolean canCreate()
Asks if the resource handler can be created or not. For example a lack of a certain role can return false.- Returns:
- If true this resource handler can be added.
-
create
void create(org.guvnor.common.services.project.model.Package pkg, String baseFileName, NewResourcePresenter presenter)An entry-point for the creation of the new resource- Parameters:
pkg- the Package context where new resource should be createdbaseFileName- the base name of the new resourcepresenter- underlying presenter
-
getExtensions
List<org.uberfire.commons.data.Pair<String,? extends com.google.gwt.user.client.ui.IsWidget>> getExtensions()
Return a List of Widgets that the NewResourceHandler can use to gather additional parameters for the new resource. The List is of Pairs, where each Pair consists of a String caption and IsWidget editor.- Returns:
- null if no extension is provided
-
validate
void validate(String baseFileName, org.uberfire.ext.editor.commons.client.validation.ValidatorWithReasonCallback callback)
Provide NewResourceHandlers with the ability to validate additional parameters before the creation of the new resource- Parameters:
baseFileName- The base file name for the new item (excluding extension)callback- Callback depending on validation result
-
supportsDefaultPackage
default boolean supportsDefaultPackage()
Indicates if the NewResourceHandler can create the assets on the default package- Returns:
-
acceptContext
void acceptContext(com.google.gwt.core.client.Callback<Boolean,Void> callback)
Indicates if the NewResourceHandler can create a resource to this path
-
getCommand
org.uberfire.mvp.Command getCommand(NewResourcePresenter newResourcePresenter)
A command to execute instead of defaulting to the NewResourceView. If this returns null the NewResourceView is shown by default.- Parameters:
newResourcePresenter-- Returns:
-
order
default int order()
Defines the handler order for UI purposes.- Returns:
- The handler order. The smallest number comes first.
-
isProjectAsset
default boolean isProjectAsset()
Defines whether this resource is a project asset and should appear on the Add Asset screen- Returns:
- true if it is a project asset; false otherwise.
-
getProfiles
default List<org.kie.workbench.common.profile.api.preferences.Profile> getProfiles()
Defines the list of profiles where this resource handler should be used.
By default it supports all profiles.- Returns:
- the list of supported Profiles
-
-