Files
alfresco-community-repo/source/java/org/alfresco/web/bean/wcm/CreateFolderDialog.java
Kevin Roast 3730a608ee . Checkout of the "Define Web Content Forms" dialog
- Scrollable list of registered Form Templates
 - Add to List feature to add selected form template to data list
 - Remove Form Template
 - Fist pass of Form Template Details page
. UISelectList component now support "rowIndex" property for single components rendered multiple times in a list
 - This allows command buttons etc. to be rendered multiple times but have access to the correct row data during event handling
. Minor UI tidy ups to UIData based tables with "no items"
. Some code cleanup, use of logger pattern

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4270 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2006-11-02 13:51:51 +00:00

131 lines
3.4 KiB
Java

/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.web.bean.wcm;
import java.util.Map;
import javax.faces.context.FacesContext;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.web.bean.dialog.BaseDialogBean;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Bean implementation for the AVM "Create Folder" dialog.
*
* @author Kevin Roast
*/
public class CreateFolderDialog extends BaseDialogBean
{
private static final Log logger = LogFactory.getLog(CreateFolderDialog.class);
protected AVMService avmService;
protected AVMBrowseBean avmBrowseBean;
private String name;
private String description;
/**
* @see org.alfresco.web.bean.dialog.BaseDialogBean#init(java.util.Map)
*/
@Override
public void init(Map<String, String> parameters)
{
super.init(parameters);
this.name = null;
this.description = null;
}
/**
* @param avmBrowseBean The avmBrowseBean to set.
*/
public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean)
{
this.avmBrowseBean = avmBrowseBean;
}
/**
* @param avmService The avmService to set.
*/
public void setAvmService(AVMService avmService)
{
this.avmService = avmService;
}
/**
* @return Returns the description.
*/
public String getDescription()
{
return this.description;
}
/**
* @param description The description to set.
*/
public void setDescription(String description)
{
this.description = description;
}
/**
* @return Returns the name.
*/
public String getName()
{
return this.name;
}
/**
* @param name The name to set.
*/
public void setName(String name)
{
this.name = name;
}
// ------------------------------------------------------------------------------
// Dialog implementation
/**
* @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String)
*/
@Override
protected String finishImpl(FacesContext context, String outcome) throws Exception
{
String parent = this.avmBrowseBean.getCurrentPath();
this.avmService.createDirectory(parent, this.name);
String path = parent + '/' + this.name;
NodeRef nodeRef = AVMNodeConverter.ToNodeRef(-1, path);
this.nodeService.addAspect(nodeRef, ContentModel.ASPECT_UIFACETS, null);
if (this.description != null && this.description.length() != 0)
{
this.nodeService.setProperty(nodeRef, ContentModel.PROP_DESCRIPTION, this.description);
}
return outcome;
}
}