mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
. Fix up for several merge issues in UI classes
. Framework for new SelectList component git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4221 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -102,7 +102,7 @@
|
|||||||
</action>
|
</action>
|
||||||
|
|
||||||
<!-- Create AVM Content -->
|
<!-- Create AVM Content -->
|
||||||
<action id="create_content">
|
<action id="create_avm_content">
|
||||||
<permissions>
|
<permissions>
|
||||||
<permission allow="true">CreateChildren</permission>
|
<permission allow="true">CreateChildren</permission>
|
||||||
</permissions>
|
</permissions>
|
||||||
@@ -223,7 +223,7 @@
|
|||||||
<action-group id="avm_create_menu">
|
<action-group id="avm_create_menu">
|
||||||
<show-link>false</show-link>
|
<show-link>false</show-link>
|
||||||
<action idref="add_content" />
|
<action idref="add_content" />
|
||||||
<action idref="create_content" />
|
<action idref="create_avm_content" />
|
||||||
<action idref="create_folder" />
|
<action idref="create_folder" />
|
||||||
</action-group>
|
</action-group>
|
||||||
|
|
||||||
|
@@ -42,7 +42,7 @@ public class EditContentPropertiesDialog extends BaseDialogBean
|
|||||||
super.init(parameters);
|
super.init(parameters);
|
||||||
|
|
||||||
// setup the editable node
|
// setup the editable node
|
||||||
this.editableNode = new Node(this.browseBean.getDocument().getNodeRef());
|
this.editableNode = initEditableNode();
|
||||||
|
|
||||||
// special case for Mimetype - since this is a sub-property of the ContentData object
|
// special case for Mimetype - since this is a sub-property of the ContentData object
|
||||||
// we must extract it so it can be edited in the client, then we check for it later
|
// we must extract it so it can be edited in the client, then we check for it later
|
||||||
@@ -54,11 +54,19 @@ public class EditContentPropertiesDialog extends BaseDialogBean
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init the editable Node
|
||||||
|
*/
|
||||||
|
protected Node initEditableNode()
|
||||||
|
{
|
||||||
|
return new Node(this.browseBean.getDocument().getNodeRef());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String finishImpl(FacesContext context, String outcome)
|
protected String finishImpl(FacesContext context, String outcome)
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
NodeRef nodeRef = this.browseBean.getDocument().getNodeRef();
|
NodeRef nodeRef = this.editableNode.getNodeRef();
|
||||||
Map<String, Object> editedProps = this.editableNode.getProperties();
|
Map<String, Object> editedProps = this.editableNode.getProperties();
|
||||||
|
|
||||||
// get the name and move the node as necessary
|
// get the name and move the node as necessary
|
||||||
@@ -68,9 +76,9 @@ public class EditContentPropertiesDialog extends BaseDialogBean
|
|||||||
fileFolderService.rename(nodeRef, name);
|
fileFolderService.rename(nodeRef, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<QName, Serializable> repoProps = this.nodeService.getProperties(nodeRef);
|
|
||||||
// we need to put all the properties from the editable bag back into
|
// we need to put all the properties from the editable bag back into
|
||||||
// the format expected by the repository
|
// the format expected by the repository
|
||||||
|
Map<QName, Serializable> repoProps = this.nodeService.getProperties(nodeRef);
|
||||||
|
|
||||||
// but first extract and deal with the special mimetype property for ContentData
|
// but first extract and deal with the special mimetype property for ContentData
|
||||||
String mimetype = (String)editedProps.get(TEMP_PROP_MIMETYPE);
|
String mimetype = (String)editedProps.get(TEMP_PROP_MIMETYPE);
|
||||||
@@ -233,6 +241,7 @@ public class EditContentPropertiesDialog extends BaseDialogBean
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// Bean getters and setters
|
// Bean getters and setters
|
||||||
|
|
||||||
|
@@ -325,8 +325,7 @@ public class DashboardWizard extends BaseWizardBean
|
|||||||
item.setLabel(label);
|
item.setLabel(label);
|
||||||
item.setTooltip(desc);
|
item.setTooltip(desc);
|
||||||
item.setValue(layoutDef.Id);
|
item.setValue(layoutDef.Id);
|
||||||
// set the special attribute used by the imageRadioPicker component
|
item.setImage(layoutDef.Image);
|
||||||
item.getAttributes().put("image", layoutDef.Image);
|
|
||||||
icons.add(item);
|
icons.add(item);
|
||||||
|
|
||||||
// build UIDescription to represent the layout description text
|
// build UIDescription to represent the layout description text
|
||||||
|
@@ -504,7 +504,7 @@ public class CreateSpaceWizard extends BaseWizardBean
|
|||||||
defaultItem.setValue(ContentModel.TYPE_FOLDER.toString());
|
defaultItem.setValue(ContentModel.TYPE_FOLDER.toString());
|
||||||
defaultItem.setLabel(defaultLabel);
|
defaultItem.setLabel(defaultLabel);
|
||||||
defaultItem.setTooltip(defaultLabel);
|
defaultItem.setTooltip(defaultLabel);
|
||||||
defaultItem.getAttributes().put("image", DEFAULT_SPACE_TYPE_ICON_PATH);
|
defaultItem.setImage(DEFAULT_SPACE_TYPE_ICON_PATH);
|
||||||
this.folderTypes.add(defaultItem);
|
this.folderTypes.add(defaultItem);
|
||||||
|
|
||||||
UIDescription defaultDesc = new UIDescription();
|
UIDescription defaultDesc = new UIDescription();
|
||||||
@@ -561,10 +561,10 @@ public class CreateSpaceWizard extends BaseWizardBean
|
|||||||
}
|
}
|
||||||
|
|
||||||
UIListItem item = new UIListItem();
|
UIListItem item = new UIListItem();
|
||||||
item.getAttributes().put("value", idQName.toString());
|
item.setValue(idQName.toString());
|
||||||
item.getAttributes().put("label", label);
|
item.setLabel(label);
|
||||||
item.getAttributes().put("tooltip", label);
|
item.setTooltip(label);
|
||||||
item.getAttributes().put("image", icon);
|
item.setImage(icon);
|
||||||
this.folderTypes.add(item);
|
this.folderTypes.add(item);
|
||||||
|
|
||||||
UIDescription desc = new UIDescription();
|
UIDescription desc = new UIDescription();
|
||||||
@@ -665,7 +665,7 @@ public class CreateSpaceWizard extends BaseWizardBean
|
|||||||
|
|
||||||
UIListItem item = new UIListItem();
|
UIListItem item = new UIListItem();
|
||||||
item.setValue(iconName);
|
item.setValue(iconName);
|
||||||
item.getAttributes().put("image", iconPath);
|
item.setImage(iconPath);
|
||||||
icons.add(item);
|
icons.add(item);
|
||||||
iconNames.add(iconName);
|
iconNames.add(iconName);
|
||||||
}
|
}
|
||||||
@@ -681,7 +681,7 @@ public class CreateSpaceWizard extends BaseWizardBean
|
|||||||
|
|
||||||
UIListItem item = new UIListItem();
|
UIListItem item = new UIListItem();
|
||||||
item.setValue(DEFAULT_SPACE_ICON_NAME);
|
item.setValue(DEFAULT_SPACE_ICON_NAME);
|
||||||
item.getAttributes().put("image", "/images/icons/space-icon-default.gif");
|
item.setImage("/images/icons/space-icon-default.gif");
|
||||||
icons.add(item);
|
icons.add(item);
|
||||||
iconNames.add(DEFAULT_SPACE_ICON_NAME);
|
iconNames.add(DEFAULT_SPACE_ICON_NAME);
|
||||||
}
|
}
|
||||||
|
@@ -31,7 +31,7 @@ public class EditSpaceDialog extends CreateSpaceDialog
|
|||||||
super.init(parameters);
|
super.init(parameters);
|
||||||
|
|
||||||
// setup the space being edited
|
// setup the space being edited
|
||||||
this.editableNode = new Node(this.browseBean.getActionSpace().getNodeRef());
|
this.editableNode = initEditableNode();
|
||||||
this.spaceType = this.editableNode.getType().toString();
|
this.spaceType = this.editableNode.getType().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ public class EditSpaceDialog extends CreateSpaceDialog
|
|||||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||||
{
|
{
|
||||||
// update the existing node in the repository
|
// update the existing node in the repository
|
||||||
NodeRef nodeRef = this.browseBean.getActionSpace().getNodeRef();
|
NodeRef nodeRef = this.editableNode.getNodeRef();
|
||||||
Map<String, Object> editedProps = this.editableNode.getProperties();
|
Map<String, Object> editedProps = this.editableNode.getProperties();
|
||||||
|
|
||||||
// handle the name property separately, perform a rename in case it changed
|
// handle the name property separately, perform a rename in case it changed
|
||||||
@@ -163,4 +163,18 @@ public class EditSpaceDialog extends CreateSpaceDialog
|
|||||||
|
|
||||||
return outcome;
|
return outcome;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------
|
||||||
|
// Bean getters and setters
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the node being edited
|
||||||
|
*
|
||||||
|
* @return The node being edited
|
||||||
|
*/
|
||||||
|
public Node getEditableNode()
|
||||||
|
{
|
||||||
|
return this.editableNode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -165,7 +165,7 @@ public class EditFolderPropertiesDialog extends EditSpaceDialog
|
|||||||
|
|
||||||
UIListItem item = new UIListItem();
|
UIListItem item = new UIListItem();
|
||||||
item.setValue(DEFAULT_SPACE_ICON_NAME);
|
item.setValue(DEFAULT_SPACE_ICON_NAME);
|
||||||
item.getAttributes().put("image", "/images/icons/" + DEFAULT_SPACE_ICON_NAME + ".gif");
|
item.setImage("/images/icons/" + DEFAULT_SPACE_ICON_NAME + ".gif");
|
||||||
icons.add(item);
|
icons.add(item);
|
||||||
|
|
||||||
return icons;
|
return icons;
|
||||||
|
@@ -40,12 +40,14 @@ public class UIListItem extends SelfRenderingComponent
|
|||||||
*/
|
*/
|
||||||
public Object saveState(FacesContext context)
|
public Object saveState(FacesContext context)
|
||||||
{
|
{
|
||||||
Object values[] = new Object[5];
|
Object values[] = new Object[7];
|
||||||
values[0] = super.saveState(context);
|
values[0] = super.saveState(context);
|
||||||
values[1] = this.value;
|
values[1] = this.value;
|
||||||
values[2] = this.disabled;
|
values[2] = this.disabled;
|
||||||
values[3] = this.label;
|
values[3] = this.label;
|
||||||
values[4] = this.tooltip;
|
values[4] = this.description;
|
||||||
|
values[5] = this.tooltip;
|
||||||
|
values[6] = this.image;
|
||||||
return ((Object) (values));
|
return ((Object) (values));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,7 +61,9 @@ public class UIListItem extends SelfRenderingComponent
|
|||||||
this.value = values[1];
|
this.value = values[1];
|
||||||
this.disabled = (Boolean)values[2];
|
this.disabled = (Boolean)values[2];
|
||||||
this.label = (String)values[3];
|
this.label = (String)values[3];
|
||||||
this.tooltip = (String)values[4];
|
this.description = (String)values[4];
|
||||||
|
this.tooltip = (String)values[5];
|
||||||
|
this.image = (String)values[6];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -150,6 +154,50 @@ public class UIListItem extends SelfRenderingComponent
|
|||||||
this.label = label;
|
this.label = label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Returns the description.
|
||||||
|
*/
|
||||||
|
public String getDescription()
|
||||||
|
{
|
||||||
|
ValueBinding vb = getValueBinding("description");
|
||||||
|
if (vb != null)
|
||||||
|
{
|
||||||
|
this.description = (String)vb.getValue(getFacesContext());
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description The description to set.
|
||||||
|
*/
|
||||||
|
public void setDescription(String description)
|
||||||
|
{
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Returns the image.
|
||||||
|
*/
|
||||||
|
public String getImage()
|
||||||
|
{
|
||||||
|
ValueBinding vb = getValueBinding("image");
|
||||||
|
if (vb != null)
|
||||||
|
{
|
||||||
|
this.image = (String)vb.getValue(getFacesContext());
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.image;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param image The image to set.
|
||||||
|
*/
|
||||||
|
public void setImage(String image)
|
||||||
|
{
|
||||||
|
this.image = image;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns the tooltip.
|
* @return Returns the tooltip.
|
||||||
*/
|
*/
|
||||||
@@ -187,4 +235,10 @@ public class UIListItem extends SelfRenderingComponent
|
|||||||
|
|
||||||
/** the label */
|
/** the label */
|
||||||
private String label;
|
private String label;
|
||||||
|
|
||||||
|
/** the description */
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/** the image */
|
||||||
|
private String image;
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,245 @@
|
|||||||
|
/*
|
||||||
|
* 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.common.component;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.faces.component.NamingContainer;
|
||||||
|
import javax.faces.component.UICommand;
|
||||||
|
import javax.faces.component.UIComponent;
|
||||||
|
import javax.faces.component.UIForm;
|
||||||
|
import javax.faces.context.FacesContext;
|
||||||
|
import javax.faces.context.ResponseWriter;
|
||||||
|
import javax.faces.el.ValueBinding;
|
||||||
|
import javax.faces.event.AbortProcessingException;
|
||||||
|
import javax.faces.event.FacesEvent;
|
||||||
|
|
||||||
|
import org.alfresco.web.ui.common.Utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Kevin Roast
|
||||||
|
*/
|
||||||
|
public class UISelectList extends UICommand
|
||||||
|
{
|
||||||
|
private Boolean multiSelect;
|
||||||
|
private String buttonLabel;
|
||||||
|
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------
|
||||||
|
// Construction
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default Constructor
|
||||||
|
*/
|
||||||
|
public UISelectList()
|
||||||
|
{
|
||||||
|
setRendererType(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------
|
||||||
|
// Component Impl
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see javax.faces.component.UIComponent#getFamily()
|
||||||
|
*/
|
||||||
|
public String getFamily()
|
||||||
|
{
|
||||||
|
return "org.alfresco.faces.Controls";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see javax.faces.component.StateHolder#restoreState(javax.faces.context.FacesContext, java.lang.Object)
|
||||||
|
*/
|
||||||
|
public void restoreState(FacesContext context, Object state)
|
||||||
|
{
|
||||||
|
Object values[] = (Object[])state;
|
||||||
|
// standard component attributes are restored by the super class
|
||||||
|
super.restoreState(context, values[0]);
|
||||||
|
this.multiSelect = (Boolean)values[1];
|
||||||
|
this.buttonLabel = (String)values[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see javax.faces.component.StateHolder#saveState(javax.faces.context.FacesContext)
|
||||||
|
*/
|
||||||
|
public Object saveState(FacesContext context)
|
||||||
|
{
|
||||||
|
Object values[] = new Object[3];
|
||||||
|
// standard component attributes are saved by the super class
|
||||||
|
values[0] = super.saveState(context);
|
||||||
|
values[1] = this.multiSelect;
|
||||||
|
values[2] = this.buttonLabel;
|
||||||
|
return (values);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see javax.faces.render.Renderer#decode(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
|
||||||
|
*/
|
||||||
|
public void decode(FacesContext context, UIComponent component)
|
||||||
|
{
|
||||||
|
Map requestMap = context.getExternalContext().getRequestParameterMap();
|
||||||
|
String fieldId = getHiddenFieldName(context, component);
|
||||||
|
String value = (String)requestMap.get(fieldId);
|
||||||
|
|
||||||
|
// we encoded the value to start with our Id
|
||||||
|
if (value != null && value.startsWith(component.getClientId(context) + NamingContainer.SEPARATOR_CHAR))
|
||||||
|
{
|
||||||
|
String selectedValue = value.substring(component.getClientId(context).length() + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see javax.faces.component.UIComponentBase#encodeBegin(javax.faces.context.FacesContext)
|
||||||
|
*/
|
||||||
|
public void encodeBegin(FacesContext context) throws IOException
|
||||||
|
{
|
||||||
|
if (isRendered() == false)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ResponseWriter out = context.getResponseWriter();
|
||||||
|
|
||||||
|
// get the child components and look for compatible ListItem objects
|
||||||
|
for (Iterator i = getChildren().iterator(); i.hasNext(); /**/)
|
||||||
|
{
|
||||||
|
UIComponent child = (UIComponent)i.next();
|
||||||
|
if (child instanceof UIListItems)
|
||||||
|
{
|
||||||
|
// get the value of the list items component and iterate through it's collection
|
||||||
|
Object listItems = ((UIListItems)child).getValue();
|
||||||
|
if (listItems instanceof Collection)
|
||||||
|
{
|
||||||
|
for (Iterator iter = ((Collection)listItems).iterator(); iter.hasNext(); /**/)
|
||||||
|
{
|
||||||
|
UIListItem item = (UIListItem)iter.next();
|
||||||
|
if (item.isRendered())
|
||||||
|
{
|
||||||
|
renderItem(context, out, item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (child instanceof UIListItem)
|
||||||
|
{
|
||||||
|
if (child.isRendered())
|
||||||
|
{
|
||||||
|
// found a valid UIListItem child to render
|
||||||
|
UIListItem item = (UIListItem)child;
|
||||||
|
renderItem(context, out, item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render a list item in the appropriate selection mode
|
||||||
|
*
|
||||||
|
* @param context FacesContext
|
||||||
|
* @param out ResponseWriter
|
||||||
|
* @param item UIListItem representing the item to render
|
||||||
|
*/
|
||||||
|
private void renderItem(FacesContext context, ResponseWriter out, UIListItem item)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see javax.faces.component.UICommand#broadcast(javax.faces.event.FacesEvent)
|
||||||
|
*/
|
||||||
|
public void broadcast(FacesEvent event) throws AbortProcessingException
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------
|
||||||
|
// Strongly typed property accessors
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the multi-select rendering flag
|
||||||
|
*
|
||||||
|
* @return true for multi-select rendering, false otherwise
|
||||||
|
*/
|
||||||
|
public boolean isMultiSelect()
|
||||||
|
{
|
||||||
|
ValueBinding vb = getValueBinding("multiSelect");
|
||||||
|
if (vb != null)
|
||||||
|
{
|
||||||
|
this.multiSelect = (Boolean)vb.getValue(getFacesContext());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.multiSelect != null)
|
||||||
|
{
|
||||||
|
return this.multiSelect.booleanValue();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// return the default
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set true for multi-select rendering, false otherwise
|
||||||
|
*
|
||||||
|
* @param multiSelect True for multi-select
|
||||||
|
*/
|
||||||
|
public void setMultiSelect(boolean multiSelect)
|
||||||
|
{
|
||||||
|
this.multiSelect = multiSelect;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Returns the action button label.
|
||||||
|
*/
|
||||||
|
public String getButtonLabel()
|
||||||
|
{
|
||||||
|
ValueBinding vb = getValueBinding("buttonLabel");
|
||||||
|
if (vb != null)
|
||||||
|
{
|
||||||
|
this.buttonLabel = (String)vb.getValue(getFacesContext());
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.buttonLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param buttonLabel The action button label to set.
|
||||||
|
*/
|
||||||
|
public void setButtonLabel(String buttonLabel)
|
||||||
|
{
|
||||||
|
this.buttonLabel = buttonLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* We use a hidden field name based on the parent form component Id and
|
||||||
|
* the string "selectlist" to give a hidden field name that can be shared by all
|
||||||
|
* SelectList components within a single UIForm component.
|
||||||
|
*
|
||||||
|
* @return hidden field name
|
||||||
|
*/
|
||||||
|
private static String getHiddenFieldName(FacesContext context, UIComponent component)
|
||||||
|
{
|
||||||
|
UIForm form = Utils.getParentForm(context, component);
|
||||||
|
return form.getClientId(context) + NamingContainer.SEPARATOR_CHAR + "selectlist";
|
||||||
|
}
|
||||||
|
}
|
@@ -154,7 +154,7 @@ public class ImagePickerRadioRenderer extends BaseRenderer
|
|||||||
{
|
{
|
||||||
UIListItem item = new UIListItem();
|
UIListItem item = new UIListItem();
|
||||||
item.setValue(iconName);
|
item.setValue(iconName);
|
||||||
item.getAttributes().put("image", iconPath);
|
item.setImage(iconPath);
|
||||||
renderItem(context, out, imagePicker, item, onclick);
|
renderItem(context, out, imagePicker, item, onclick);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -324,7 +324,7 @@ public class ImagePickerRadioRenderer extends BaseRenderer
|
|||||||
out.write("</td><td align='center'>");
|
out.write("</td><td align='center'>");
|
||||||
|
|
||||||
// get the image and make sure there is one!
|
// get the image and make sure there is one!
|
||||||
String image = (String)item.getAttributes().get("image");
|
String image = item.getImage();
|
||||||
if (image == null)
|
if (image == null)
|
||||||
{
|
{
|
||||||
throw new IllegalStateException("All child items must specify an image");
|
throw new IllegalStateException("All child items must specify an image");
|
||||||
|
@@ -336,7 +336,7 @@ public class ModeListRenderer extends BaseRenderer
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// else show the image set for the individual item
|
// else show the image set for the individual item
|
||||||
String image = (String)item.getAttributes().get("image");
|
String image = item.getImage();
|
||||||
if (image != null)
|
if (image != null)
|
||||||
{
|
{
|
||||||
out.write( Utils.buildImageTag(context, image, item.getTooltip()) );
|
out.write( Utils.buildImageTag(context, image, item.getTooltip()) );
|
||||||
|
@@ -48,6 +48,7 @@ public class ListItemTag extends BaseComponentTag
|
|||||||
super.setProperties(component);
|
super.setProperties(component);
|
||||||
setStringProperty(component, "tooltip", this.tooltip);
|
setStringProperty(component, "tooltip", this.tooltip);
|
||||||
setStringProperty(component, "label", this.label);
|
setStringProperty(component, "label", this.label);
|
||||||
|
setStringProperty(component, "description", this.description);
|
||||||
setStringProperty(component, "image", this.image);
|
setStringProperty(component, "image", this.image);
|
||||||
setStringProperty(component, "value", this.value);
|
setStringProperty(component, "value", this.value);
|
||||||
setBooleanProperty(component, "disabled", this.disabled);
|
setBooleanProperty(component, "disabled", this.disabled);
|
||||||
@@ -61,6 +62,7 @@ public class ListItemTag extends BaseComponentTag
|
|||||||
super.release();
|
super.release();
|
||||||
this.tooltip = null;
|
this.tooltip = null;
|
||||||
this.label = null;
|
this.label = null;
|
||||||
|
this.description = null;
|
||||||
this.image = null;
|
this.image = null;
|
||||||
this.value = null;
|
this.value = null;
|
||||||
this.disabled = null;
|
this.disabled = null;
|
||||||
@@ -86,6 +88,16 @@ public class ListItemTag extends BaseComponentTag
|
|||||||
this.label = label;
|
this.label = label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the description
|
||||||
|
*
|
||||||
|
* @param description the description
|
||||||
|
*/
|
||||||
|
public void setDescription(String description)
|
||||||
|
{
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the image
|
* Set the image
|
||||||
*
|
*
|
||||||
@@ -130,4 +142,7 @@ public class ListItemTag extends BaseComponentTag
|
|||||||
|
|
||||||
/** the disabled flag */
|
/** the disabled flag */
|
||||||
private String disabled;
|
private String disabled;
|
||||||
|
|
||||||
|
/** the description */
|
||||||
|
private String description;
|
||||||
}
|
}
|
||||||
|
119
source/java/org/alfresco/web/ui/common/tag/SelectListTag.java
Normal file
119
source/java/org/alfresco/web/ui/common/tag/SelectListTag.java
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
/*
|
||||||
|
* 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.common.tag;
|
||||||
|
|
||||||
|
import javax.faces.component.UICommand;
|
||||||
|
import javax.faces.component.UIComponent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Kevin Roast
|
||||||
|
*/
|
||||||
|
public class SelectListTag extends HtmlComponentTag
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @see javax.faces.webapp.UIComponentTag#getComponentType()
|
||||||
|
*/
|
||||||
|
public String getComponentType()
|
||||||
|
{
|
||||||
|
return "org.alfresco.faces.SelectList";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see javax.faces.webapp.UIComponentTag#getRendererType()
|
||||||
|
*/
|
||||||
|
public String getRendererType()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see javax.faces.webapp.UIComponentTag#setProperties(javax.faces.component.UIComponent)
|
||||||
|
*/
|
||||||
|
protected void setProperties(UIComponent component)
|
||||||
|
{
|
||||||
|
super.setProperties(component);
|
||||||
|
setActionProperty((UICommand)component, this.action);
|
||||||
|
setActionListenerProperty((UICommand)component, this.actionListener);
|
||||||
|
setBooleanProperty(component, "multiSelect", this.multiSelect);
|
||||||
|
setStringProperty(component, "buttonLabel", this.buttonLabel);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see javax.servlet.jsp.tagext.Tag#release()
|
||||||
|
*/
|
||||||
|
public void release()
|
||||||
|
{
|
||||||
|
super.release();
|
||||||
|
this.action = null;
|
||||||
|
this.actionListener = null;
|
||||||
|
this.multiSelect = null;
|
||||||
|
this.buttonLabel = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the action
|
||||||
|
*
|
||||||
|
* @param action the action
|
||||||
|
*/
|
||||||
|
public void setAction(String action)
|
||||||
|
{
|
||||||
|
this.action = action;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the actionListener
|
||||||
|
*
|
||||||
|
* @param actionListener the actionListener
|
||||||
|
*/
|
||||||
|
public void setActionListener(String actionListener)
|
||||||
|
{
|
||||||
|
this.actionListener = actionListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the multiSelect
|
||||||
|
*
|
||||||
|
* @param multiSelect the multiSelect
|
||||||
|
*/
|
||||||
|
public void setMultiSelect(String multiSelect)
|
||||||
|
{
|
||||||
|
this.multiSelect = multiSelect;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the buttonLabel
|
||||||
|
*
|
||||||
|
* @param buttonLabel the buttonLabel
|
||||||
|
*/
|
||||||
|
public void setButtonLabel(String buttonLabel)
|
||||||
|
{
|
||||||
|
this.buttonLabel = buttonLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** the multiSelect */
|
||||||
|
private String multiSelect;
|
||||||
|
|
||||||
|
/** the buttonLabel */
|
||||||
|
private String buttonLabel;
|
||||||
|
|
||||||
|
/** the action */
|
||||||
|
private String action;
|
||||||
|
|
||||||
|
/** the actionListener */
|
||||||
|
private String actionListener;
|
||||||
|
}
|
@@ -1054,18 +1054,6 @@
|
|||||||
<rtexprvalue>true</rtexprvalue>
|
<rtexprvalue>true</rtexprvalue>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
|
||||||
<attribute>
|
|
||||||
<name>style</name>
|
|
||||||
<required>false</required>
|
|
||||||
<rtexprvalue>true</rtexprvalue>
|
|
||||||
</attribute>
|
|
||||||
|
|
||||||
<attribute>
|
|
||||||
<name>styleClass</name>
|
|
||||||
<required>false</required>
|
|
||||||
<rtexprvalue>true</rtexprvalue>
|
|
||||||
</attribute>
|
|
||||||
|
|
||||||
<attribute>
|
<attribute>
|
||||||
<name>tooltip</name>
|
<name>tooltip</name>
|
||||||
<required>false</required>
|
<required>false</required>
|
||||||
@@ -1078,6 +1066,12 @@
|
|||||||
<rtexprvalue>true</rtexprvalue>
|
<rtexprvalue>true</rtexprvalue>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
|
||||||
|
<attribute>
|
||||||
|
<name>description</name>
|
||||||
|
<required>false</required>
|
||||||
|
<rtexprvalue>true</rtexprvalue>
|
||||||
|
</attribute>
|
||||||
|
|
||||||
<attribute>
|
<attribute>
|
||||||
<name>image</name>
|
<name>image</name>
|
||||||
<required>false</required>
|
<required>false</required>
|
||||||
@@ -1844,4 +1838,78 @@
|
|||||||
</attribute>
|
</attribute>
|
||||||
</tag>
|
</tag>
|
||||||
|
|
||||||
|
<tag>
|
||||||
|
<name>selectList</name>
|
||||||
|
<tag-class>org.alfresco.web.ui.common.tag.SelectListTag</tag-class>
|
||||||
|
<body-content>JSP</body-content>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
The SelectList component displays a graphical list of items, each with a label and icon image.
|
||||||
|
The list has three selection modes; single select (radio), multi-select (checkbox) and command
|
||||||
|
button single item select (action).
|
||||||
|
The value for the component is a bound list of SelectListItem objects.
|
||||||
|
The selected value can be retrieved from the component or during the actionListener event handler.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<attribute>
|
||||||
|
<name>id</name>
|
||||||
|
<required>false</required>
|
||||||
|
<rtexprvalue>true</rtexprvalue>
|
||||||
|
</attribute>
|
||||||
|
|
||||||
|
<attribute>
|
||||||
|
<name>binding</name>
|
||||||
|
<required>false</required>
|
||||||
|
<rtexprvalue>true</rtexprvalue>
|
||||||
|
</attribute>
|
||||||
|
|
||||||
|
<attribute>
|
||||||
|
<name>rendered</name>
|
||||||
|
<required>false</required>
|
||||||
|
<rtexprvalue>true</rtexprvalue>
|
||||||
|
</attribute>
|
||||||
|
|
||||||
|
<attribute>
|
||||||
|
<name>style</name>
|
||||||
|
<required>false</required>
|
||||||
|
<rtexprvalue>true</rtexprvalue>
|
||||||
|
</attribute>
|
||||||
|
|
||||||
|
<attribute>
|
||||||
|
<name>styleClass</name>
|
||||||
|
<required>false</required>
|
||||||
|
<rtexprvalue>true</rtexprvalue>
|
||||||
|
</attribute>
|
||||||
|
|
||||||
|
<attribute>
|
||||||
|
<name>multiSelect</name>
|
||||||
|
<required>false</required>
|
||||||
|
<rtexprvalue>true</rtexprvalue>
|
||||||
|
</attribute>
|
||||||
|
|
||||||
|
<attribute>
|
||||||
|
<name>buttonLabel</name>
|
||||||
|
<required>false</required>
|
||||||
|
<rtexprvalue>true</rtexprvalue>
|
||||||
|
</attribute>
|
||||||
|
|
||||||
|
<attribute>
|
||||||
|
<name>action</name>
|
||||||
|
<required>false</required>
|
||||||
|
<rtexprvalue>true</rtexprvalue>
|
||||||
|
</attribute>
|
||||||
|
|
||||||
|
<attribute>
|
||||||
|
<name>actionListener</name>
|
||||||
|
<required>false</required>
|
||||||
|
<rtexprvalue>true</rtexprvalue>
|
||||||
|
</attribute>
|
||||||
|
|
||||||
|
<attribute>
|
||||||
|
<name>value</name>
|
||||||
|
<required>true</required>
|
||||||
|
<rtexprvalue>true</rtexprvalue>
|
||||||
|
</attribute>
|
||||||
|
</tag>
|
||||||
|
|
||||||
</taglib>
|
</taglib>
|
||||||
|
@@ -144,6 +144,11 @@
|
|||||||
<component-class>org.alfresco.web.ui.common.component.UIStatusMessage</component-class>
|
<component-class>org.alfresco.web.ui.common.component.UIStatusMessage</component-class>
|
||||||
</component>
|
</component>
|
||||||
|
|
||||||
|
<component>
|
||||||
|
<component-type>org.alfresco.faces.SelectList</component-type>
|
||||||
|
<component-class>org.alfresco.web.ui.common.component.UISelectList</component-class>
|
||||||
|
</component>
|
||||||
|
|
||||||
|
|
||||||
<!-- ==================== CONVERTERS ==================== -->
|
<!-- ==================== CONVERTERS ==================== -->
|
||||||
<converter>
|
<converter>
|
||||||
@@ -166,6 +171,7 @@
|
|||||||
<converter-class>org.alfresco.web.ui.common.converter.MultiValueConverter</converter-class>
|
<converter-class>org.alfresco.web.ui.common.converter.MultiValueConverter</converter-class>
|
||||||
</converter>
|
</converter>
|
||||||
|
|
||||||
|
|
||||||
<!-- ==================== RENDERERS ==================== -->
|
<!-- ==================== RENDERERS ==================== -->
|
||||||
<render-kit>
|
<render-kit>
|
||||||
<!-- custom Data Picker renderer for a UI Input component -->
|
<!-- custom Data Picker renderer for a UI Input component -->
|
||||||
|
Reference in New Issue
Block a user