Big honkin' merge from head. Sheesh!

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3617 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2006-08-27 01:01:30 +00:00
parent 465ae145be
commit b0d02fa6be
241 changed files with 12379 additions and 1061 deletions

View File

@@ -32,6 +32,7 @@ import org.alfresco.web.ui.repo.component.property.BaseAssociationEditor;
import org.alfresco.web.ui.repo.component.property.PropertySheetItem;
import org.alfresco.web.ui.repo.component.property.UIProperty;
import org.alfresco.web.ui.repo.component.property.UIPropertySheet;
import org.alfresco.web.ui.repo.component.property.UISeparator;
import org.alfresco.web.ui.repo.component.property.UIPropertySheet.ClientValidation;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -83,6 +84,12 @@ public abstract class BaseComponentGenerator implements IComponentGenerator
// setup any converter the property needs
setupConverter(context, propertySheet, item, propertyDef, component);
}
else if (item instanceof UISeparator)
{
// just create the component and add it
component = createComponent(context, propertySheet, item);
item.getChildren().add(component);
}
else
{
// get the association definition

View File

@@ -1,7 +1,10 @@
package org.alfresco.web.bean.generator;
import java.util.Date;
import javax.faces.component.UIComponent;
import javax.faces.component.UIOutput;
import javax.faces.component.UISelectOne;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
@@ -11,6 +14,7 @@ import org.alfresco.web.app.servlet.FacesHelper;
import org.alfresco.web.ui.common.ComponentConstants;
import org.alfresco.web.ui.common.converter.XMLDateConverter;
import org.alfresco.web.ui.repo.RepoConstants;
import org.alfresco.web.ui.repo.component.UIMultiValueEditor;
import org.alfresco.web.ui.repo.component.property.PropertySheetItem;
import org.alfresco.web.ui.repo.component.property.UIPropertySheet;
@@ -21,8 +25,43 @@ import org.alfresco.web.ui.repo.component.property.UIPropertySheet;
*/
public class DatePickerGenerator extends BaseComponentGenerator
{
private int yearCount = 30;
private int startYear = new Date().getYear() + 1900 + 2;
private static final String MSG_DATE = "date_pattern";
/**
* @return Returns the year to start counting back from
*/
public int getStartYear()
{
return startYear;
}
/**
* @param startYear Sets the year to start counting back from
*/
public void setStartYear(int startYear)
{
this.startYear = startYear;
}
/**
* @return Returns the number of years to show
*/
public int getYearCount()
{
return yearCount;
}
/**
* @param yearCount Sets the number of years to show
*/
public void setYearCount(int yearCount)
{
this.yearCount = yearCount;
}
@SuppressWarnings("unchecked")
public UIComponent generate(FacesContext context, String id)
{
@@ -30,7 +69,8 @@ public class DatePickerGenerator extends BaseComponentGenerator
createComponent(ComponentConstants.JAVAX_FACES_INPUT);
component.setRendererType(RepoConstants.ALFRESCO_FACES_DATE_PICKER_RENDERER);
FacesHelper.setupComponentId(context, component, id);
component.getAttributes().put("yearCount", new Integer(30));
component.getAttributes().put("startYear", this.startYear);
component.getAttributes().put("yearCount", this.yearCount);
component.getAttributes().put("style", "margin-right: 7px;");
return component;
@@ -59,8 +99,26 @@ public class DatePickerGenerator extends BaseComponentGenerator
UIPropertySheet propertySheet, PropertySheetItem item,
UIComponent component, boolean realTimeChecking, String idSuffix)
{
// a date picker will always have a date value so there
// is no need to create a mandatory validation rule
if (component instanceof UIMultiValueEditor)
{
// Override the setup of the mandatory validation
// so we can send the _current_value id suffix.
// We also enable real time so the page load
// check disables the ok button if necessary, as the user
// adds or removes items from the multi value list the
// page will be refreshed and therefore re-check the status.
super.setupMandatoryValidation(context, propertySheet, item,
component, true, "_current_value");
}
else
{
// setup the client validation rule with real time validation enabled
// so that the initial page load checks the state of the date
super.setupMandatoryValidation(context, propertySheet, item,
component, true, idSuffix);
}
}
/**

View File

@@ -0,0 +1,23 @@
package org.alfresco.web.bean.generator;
import javax.faces.component.UIComponent;
import org.alfresco.web.ui.repo.component.property.PropertySheetItem;
/**
* Generates a component to represent a separator that gets rendered
* as a header.
*
* @author gavinc
*/
public class HeaderSeparatorGenerator extends SeparatorGenerator
{
@Override
protected String getHtml(UIComponent component, PropertySheetItem item)
{
String html = "<div class='wizardSectionHeading mainSubTitle' style='margin-top: 6px; margin-bottom: 6px;'>&nbsp;" +
item.getDisplayLabel() + "</div>";
return html;
}
}

View File

@@ -0,0 +1,49 @@
package org.alfresco.web.bean.generator;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import org.alfresco.web.ui.repo.component.property.PropertySheetItem;
import org.alfresco.web.ui.repo.component.property.UIPropertySheet;
/**
* Generates a component to represent a separator.
*
* @author gavinc
*/
public class SeparatorGenerator extends BaseComponentGenerator
{
@SuppressWarnings("unchecked")
public UIComponent generate(FacesContext context, String id)
{
UIComponent component = this.createOutputTextComponent(context, id);
component.getAttributes().put("escape", Boolean.FALSE);
return component;
}
@Override
@SuppressWarnings("unchecked")
protected UIComponent createComponent(FacesContext context, UIPropertySheet propertySheet,
PropertySheetItem item)
{
UIComponent component = this.generate(context, item.getName());
// set the HTML to use
component.getAttributes().put("value", getHtml(component, item));
return component;
}
/**
* Returns the HTML to display for the separator
*
* @param component The JSF component representing the separator
* @param item The separator item
* @return The HTML
*/
protected String getHtml(UIComponent component, PropertySheetItem item)
{
return "<div style='margin-top: 6px; margin-bottom: 6px;'><hr/></div>";
}
}

View File

@@ -0,0 +1,64 @@
package org.alfresco.web.bean.generator;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import org.alfresco.web.app.servlet.FacesHelper;
import org.alfresco.web.ui.common.ComponentConstants;
/**
* Generates a text field component.
*
* @author gavinc
*/
public class TextAreaGenerator extends TextFieldGenerator
{
private int rows = 3;
private int columns = 32;
/**
* @return Returns the number of columns
*/
public int getColumns()
{
return columns;
}
/**
* @param columns Sets the number of columns
*/
public void setColumns(int columns)
{
this.columns = columns;
}
/**
* @return Returns the number of rows
*/
public int getRows()
{
return rows;
}
/**
* @param rows Sets the number of rows
*/
public void setRows(int rows)
{
this.rows = rows;
}
@SuppressWarnings("unchecked")
public UIComponent generate(FacesContext context, String id)
{
UIComponent component = context.getApplication().
createComponent(ComponentConstants.JAVAX_FACES_INPUT);
component.setRendererType(ComponentConstants.JAVAX_FACES_TEXTAREA);
FacesHelper.setupComponentId(context, component, id);
component.getAttributes().put("rows", this.rows);
component.getAttributes().put("cols", this.columns);
return component;
}
}

View File

@@ -26,6 +26,41 @@ import org.alfresco.web.ui.repo.component.property.UIPropertySheet;
*/
public class TextFieldGenerator extends BaseComponentGenerator
{
private int size = 35;
private int maxLength = 1024;
/**
* @return Returns the default size for a text field
*/
public int getSize()
{
return size;
}
/**
* @param size Sets the size of a text field
*/
public void setSize(int size)
{
this.size = size;
}
/**
* @return Returns the max length for the text field
*/
public int getMaxLength()
{
return maxLength;
}
/**
* @param maxLength Sets the max length of the text field
*/
public void setMaxLength(int maxLength)
{
this.maxLength = maxLength;
}
@SuppressWarnings("unchecked")
public UIComponent generate(FacesContext context, String id)
{
@@ -33,8 +68,9 @@ public class TextFieldGenerator extends BaseComponentGenerator
createComponent(ComponentConstants.JAVAX_FACES_INPUT);
component.setRendererType(ComponentConstants.JAVAX_FACES_TEXT);
FacesHelper.setupComponentId(context, component, id);
component.getAttributes().put("size", "35");
component.getAttributes().put("maxlength", "1024");
component.getAttributes().put("size", this.size);
component.getAttributes().put("maxlength", this.maxLength);
return component;
}
@@ -48,12 +84,17 @@ public class TextFieldGenerator extends BaseComponentGenerator
if (propertySheet.inEditMode())
{
// if the field has the list of values constraint a
// SelectOne component is required otherwise create
// the standard edit component
// if the field has the list of values constraint
// and it is editable a SelectOne component is
// required otherwise create the standard edit component
ListOfValuesConstraint constraint = getListOfValuesConstraint(
context, propertySheet, item);
if (constraint != null)
PropertyDefinition propDef = this.getPropertyDefinition(context,
propertySheet.getNode(), item.getName());
if (constraint != null && item.isReadOnly() == false &&
propDef != null && propDef.isProtected() == false)
{
component = context.getApplication().createComponent(
UISelectOne.COMPONENT_TYPE);