Package org.opencms.ui.util
Class CmsNewResourceBuilder
- java.lang.Object
-
- org.opencms.ui.util.CmsNewResourceBuilder
-
public class CmsNewResourceBuilder extends java.lang.Object
Helper class for creating a new resource using the New dialog.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
CmsNewResourceBuilder.I_Callback
Interface for callbacks which should be notified when this helper has created a resource.class
CmsNewResourceBuilder.PropertyEditorHelper
Property helper subclass which is responsible for loading the initial property data to display in the property dialog for a resource to be created in the New dialog.
-
Constructor Summary
Constructors Constructor Description CmsNewResourceBuilder(CmsObject cms)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCallback(CmsNewResourceBuilder.I_Callback callback)
Adds a callback to be notified when the resource is created.CmsResource
createResource()
Triggers the resource creation.CmsResource
getCreatedResource()
Gets the created resource.CmsPropertiesBean
getPropertyData()
Loads the property data with which the property dialog for the new resource should be initialized.CmsResource
safeCreateResource()
Creates a resource, but doesn't throw any exceptions.void
setExplorerNameGeneration(boolean explorerNameGenerationMode)
Sets the Explorer name generation mode.void
setLocale(java.util.Locale locale)
Sets the locale.void
setModel(CmsResource modelResource)
Sets the model resource.void
setPatternPath(java.lang.String destination)
Sets the creation path containing a number pattern.void
setPropertyChanges(CmsPropertyChangeSet propertyChanges)
Sets the property changes.void
setSiteRoot(java.lang.String siteRoot)
Sets the site root of the CMS context.void
setType(java.lang.String type)
Sets the resource type name.
-
-
-
Constructor Detail
-
CmsNewResourceBuilder
public CmsNewResourceBuilder(CmsObject cms) throws CmsException
Creates a new instance.- Parameters:
cms
- the CMS context- Throws:
CmsException
- if something goes wrong
-
-
Method Detail
-
addCallback
public void addCallback(CmsNewResourceBuilder.I_Callback callback)
Adds a callback to be notified when the resource is created.- Parameters:
callback
- the callback
-
createResource
public CmsResource createResource() throws CmsException
Triggers the resource creation.- Returns:
- the created resource
- Throws:
CmsException
- if something goes wrong
-
getCreatedResource
public CmsResource getCreatedResource()
Gets the created resource.This will null before the resource creation process.
- Returns:
- the created resource
-
getPropertyData
public CmsPropertiesBean getPropertyData()
Loads the property data with which the property dialog for the new resource should be initialized.- Returns:
- the properties bean
-
safeCreateResource
public CmsResource safeCreateResource()
Creates a resource, but doesn't throw any exceptions.Exceptions will be passed to the onError method of registered callbacks.
- Returns:
- the created resource
-
setExplorerNameGeneration
public void setExplorerNameGeneration(boolean explorerNameGenerationMode)
Sets the Explorer name generation mode.- Parameters:
explorerNameGenerationMode
- the explorer name generation mode
-
setLocale
public void setLocale(java.util.Locale locale)
Sets the locale.- Parameters:
locale
- the locale
-
setModel
public void setModel(CmsResource modelResource)
Sets the model resource.- Parameters:
modelResource
- the model resource
-
setPatternPath
public void setPatternPath(java.lang.String destination)
Sets the creation path containing a number pattern.- Parameters:
destination
- the creation path
-
setPropertyChanges
public void setPropertyChanges(CmsPropertyChangeSet propertyChanges)
Sets the property changes.- Parameters:
propertyChanges
- the property changes
-
setSiteRoot
public void setSiteRoot(java.lang.String siteRoot)
Sets the site root of the CMS context.- Parameters:
siteRoot
- the site root
-
setType
public void setType(java.lang.String type)
Sets the resource type name.- Parameters:
type
- the resource type name
-
-