Added separator support into the property sheet

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3454 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2006-08-03 09:44:13 +00:00
parent d3fb5dd9fd
commit a4e8facbae
13 changed files with 333 additions and 6 deletions

View File

@@ -178,7 +178,8 @@ public class UIProperty extends PropertySheetItem
{
// if we are trying to edit a NodeRef or Path property type set it to read-only as
// these are internal properties that shouldn't be edited.
if (typeName.equals(DataTypeDefinition.NODE_REF) || typeName.equals(DataTypeDefinition.PATH))
if (typeName.equals(DataTypeDefinition.NODE_REF) || typeName.equals(DataTypeDefinition.PATH) ||
typeName.equals(DataTypeDefinition.CONTENT))
{
logger.warn("Setting property " + propDef.getName().toString() + " to read-only as it can not be edited");
control.getAttributes().put("disabled", Boolean.TRUE);

View File

@@ -43,6 +43,7 @@ import org.alfresco.web.config.PropertySheetConfigElement.AssociationConfig;
import org.alfresco.web.config.PropertySheetConfigElement.ChildAssociationConfig;
import org.alfresco.web.config.PropertySheetConfigElement.ItemConfig;
import org.alfresco.web.config.PropertySheetConfigElement.PropertyConfig;
import org.alfresco.web.config.PropertySheetConfigElement.SeparatorConfig;
import org.alfresco.web.ui.common.ComponentConstants;
import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.repo.RepoConstants;
@@ -63,6 +64,7 @@ public class UIPropertySheet extends UIPanel implements NamingContainer
private static String DEFAULT_VAR_NAME = "node";
private static String PROP_ID_PREFIX = "prop_";
private static String ASSOC_ID_PREFIX = "assoc_";
private static String SEP_ID_PREFIX = "sep_";
private List<ClientValidation> validations = new ArrayList<ClientValidation>();
private String variable;
@@ -737,6 +739,12 @@ public class UIPropertySheet extends UIPanel implements NamingContainer
propSheetItem = (PropertySheetItem)context.getApplication().
createComponent(RepoConstants.ALFRESCO_FACES_CHILD_ASSOCIATION);
}
else if (item instanceof SeparatorConfig)
{
id = SEP_ID_PREFIX + item.getName();
propSheetItem = (PropertySheetItem)context.getApplication().
createComponent(RepoConstants.ALFRESCO_FACES_SEPARATOR);
}
// now setup the common stuff across all component types
if (propSheetItem != null)

View File

@@ -0,0 +1,80 @@
/*
* 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.ui.repo.component.property;
import java.io.IOException;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import org.alfresco.web.app.servlet.FacesHelper;
import org.alfresco.web.ui.repo.RepoConstants;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Component to represent a separator within a property sheet
*
* @author gavinc
*/
public class UISeparator extends PropertySheetItem
{
public static final String COMPONENT_FAMILY = "org.alfresco.faces.Separator";
private static Log logger = LogFactory.getLog(UISeparator.class);
/**
* Default constructor
*/
public UISeparator()
{
// set the default renderer
setRendererType("org.alfresco.faces.SeparatorRenderer");
}
/**
* @see javax.faces.component.UIComponent#getFamily()
*/
public String getFamily()
{
return COMPONENT_FAMILY;
}
protected String getIncorrectParentMsg()
{
return "The separator component must be nested within a property sheet component";
}
protected void generateItem(FacesContext context, UIPropertySheet propSheet) throws IOException
{
String componentGeneratorName = this.getComponentGenerator();
if (componentGeneratorName == null)
{
componentGeneratorName = RepoConstants.GENERATOR_SEPARATOR;
}
UIComponent separator = FacesHelper.getComponentGenerator(context, componentGeneratorName).
generateAndAdd(context, propSheet, this);
if (logger.isDebugEnabled())
logger.debug("Created separator " + separator + "(" +
separator.getClientId(context) +
") for '" + this.getName() +
"' and added it to component " + this);
}
}