Class DefaultNewResourceHandler
- java.lang.Object
-
- org.kie.workbench.common.widgets.client.handlers.DefaultNewResourceHandler
-
- All Implemented Interfaces:
NewResourceHandler
public abstract class DefaultNewResourceHandler extends Object implements NewResourceHandler
Handler for the creation of new Items that require a Name and Path
-
-
Field Summary
Fields Modifier and Type Field Description protected org.uberfire.ext.widgets.common.client.common.BusyIndicatorViewbusyIndicatorViewprotected org.guvnor.common.services.project.client.context.WorkspaceProjectContextcontextprotected List<org.uberfire.commons.data.Pair<String,? extends com.google.gwt.user.client.ui.IsWidget>>extensionsprotected org.jboss.errai.common.client.api.Caller<org.kie.workbench.common.services.shared.project.KieModuleService>moduleServiceprotected javax.enterprise.event.Event<NewResourceSuccessEvent>newResourceSuccessEventprotected javax.enterprise.event.Event<org.uberfire.workbench.events.NotificationEvent>notificationEventprotected org.uberfire.client.mvp.PlaceManagerplaceManagerprotected org.jboss.errai.common.client.api.Caller<org.kie.workbench.common.services.shared.validation.ValidationService>validationService
-
Constructor Summary
Constructors Constructor Description DefaultNewResourceHandler()
-
Method Summary
All Methods Instance Methods Concrete 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 pathprotected StringbuildFileName(String baseFileName, org.uberfire.workbench.type.ResourceTypeDefinition resourceType)booleancanCreate()Asks if the resource handler can be created or not.org.uberfire.mvp.CommandgetCommand(NewResourcePresenter newResourcePresenter)A command to execute instead of defaulting to the NewResourceView.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.protected org.jboss.errai.common.client.api.RemoteCallback<org.uberfire.backend.vfs.Path>getSuccessCallback(NewResourcePresenter presenter)protected voidnotifySuccess()voidvalidate(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-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.kie.workbench.common.widgets.client.handlers.NewResourceHandler
create, getDescription, getIcon, getProfiles, getResourceType, isProjectAsset, order, supportsDefaultPackage
-
-
-
-
Field Detail
-
extensions
protected final List<org.uberfire.commons.data.Pair<String,? extends com.google.gwt.user.client.ui.IsWidget>> extensions
-
context
@Inject protected org.guvnor.common.services.project.client.context.WorkspaceProjectContext context
-
moduleService
@Inject protected org.jboss.errai.common.client.api.Caller<org.kie.workbench.common.services.shared.project.KieModuleService> moduleService
-
validationService
@Inject protected org.jboss.errai.common.client.api.Caller<org.kie.workbench.common.services.shared.validation.ValidationService> validationService
-
placeManager
@Inject protected org.uberfire.client.mvp.PlaceManager placeManager
-
notificationEvent
@Inject protected javax.enterprise.event.Event<org.uberfire.workbench.events.NotificationEvent> notificationEvent
-
newResourceSuccessEvent
@Inject protected javax.enterprise.event.Event<NewResourceSuccessEvent> newResourceSuccessEvent
-
busyIndicatorView
@Inject protected org.uberfire.ext.widgets.common.client.common.BusyIndicatorView busyIndicatorView
-
-
Method Detail
-
getExtensions
public List<org.uberfire.commons.data.Pair<String,? extends com.google.gwt.user.client.ui.IsWidget>> getExtensions()
Description copied from interface:NewResourceHandlerReturn 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.- Specified by:
getExtensionsin interfaceNewResourceHandler- Returns:
- null if no extension is provided
-
validate
public void validate(String baseFileName, org.uberfire.ext.editor.commons.client.validation.ValidatorWithReasonCallback callback)
Description copied from interface:NewResourceHandlerProvide NewResourceHandlers with the ability to validate additional parameters before the creation of the new resource- Specified by:
validatein interfaceNewResourceHandler- Parameters:
baseFileName- The base file name for the new item (excluding extension)callback- Callback depending on validation result
-
acceptContext
public void acceptContext(com.google.gwt.core.client.Callback<Boolean,Void> callback)
Description copied from interface:NewResourceHandlerIndicates if the NewResourceHandler can create a resource to this path- Specified by:
acceptContextin interfaceNewResourceHandler
-
getCommand
public org.uberfire.mvp.Command getCommand(NewResourcePresenter newResourcePresenter)
Description copied from interface:NewResourceHandlerA command to execute instead of defaulting to the NewResourceView. If this returns null the NewResourceView is shown by default.- Specified by:
getCommandin interfaceNewResourceHandler- Returns:
-
buildFileName
protected String buildFileName(String baseFileName, org.uberfire.workbench.type.ResourceTypeDefinition resourceType)
-
notifySuccess
protected void notifySuccess()
-
getSuccessCallback
protected org.jboss.errai.common.client.api.RemoteCallback<org.uberfire.backend.vfs.Path> getSuccessCallback(NewResourcePresenter presenter)
-
canCreate
public boolean canCreate()
Description copied from interface:NewResourceHandlerAsks if the resource handler can be created or not. For example a lack of a certain role can return false.- Specified by:
canCreatein interfaceNewResourceHandler- Returns:
- If true this resource handler can be added.
-
-