Added ImagePickerRadioPanel renderer and changed pages to use it.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2621 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2006-04-04 15:31:17 +00:00
parent 02f7da6dec
commit 1bc8818f37
7 changed files with 226 additions and 13 deletions

View File

@@ -0,0 +1,55 @@
package org.alfresco.web.ui.common.renderer;
import java.io.IOException;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import org.alfresco.web.ui.common.PanelGenerator;
/**
* Renderer for the image picker component that outputs the list of images
* as radio buttons within a rounded corner panel
*
* @author gavinc
*/
public class ImagePickerRadioPanelRenderer extends ImagePickerRadioRenderer
{
/**
* @see javax.faces.render.Renderer#encodeBegin(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
*/
public void encodeBegin(FacesContext context, UIComponent component) throws IOException
{
if (component.isRendered() == false)
{
return;
}
// output the start of the surrounding rounded corner panel
PanelGenerator.generatePanelStart(context.getResponseWriter(),
context.getExternalContext().getRequestContextPath(),
(String)component.getAttributes().get("panelBorder"),
(String)component.getAttributes().get("panelBgcolor"));
super.encodeBegin(context, component);
}
/**
* @see javax.faces.render.Renderer#encodeEnd(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
*/
public void encodeEnd(FacesContext context, UIComponent component) throws IOException
{
if (component.isRendered() == false)
{
return;
}
super.encodeEnd(context, component);
// output the end of the surrounding rounded corner panel
PanelGenerator.generatePanelEnd(context.getResponseWriter(),
context.getExternalContext().getRequestContextPath(),
(String)component.getAttributes().get("panelBorder"));
}
}

View File

@@ -0,0 +1,71 @@
package org.alfresco.web.ui.common.tag;
import javax.faces.component.UIComponent;
/**
* Tag to place the image picker component and radio renderer inside
* a rounded corner panel
*
* @author gavinc
*/
public class ImagePickerRadioPanelTag extends ImagePickerRadioTag
{
private String panelBorder;
private String panelBgcolor;
/**
* @see javax.faces.webapp.UIComponentTag#getComponentType()
*/
public String getComponentType()
{
return "org.alfresco.faces.ImagePicker";
}
/**
* @see javax.faces.webapp.UIComponentTag#getRendererType()
*/
public String getRendererType()
{
return "org.alfresco.faces.RadioPanel";
}
/**
* @see javax.faces.webapp.UIComponentTag#setProperties(javax.faces.component.UIComponent)
*/
protected void setProperties(UIComponent component)
{
super.setProperties(component);
setStringProperty(component, "panelBorder", this.panelBorder);
setStringProperty(component, "panelBgcolor", this.panelBgcolor);
}
/**
* @see javax.servlet.jsp.tagext.Tag#release()
*/
public void release()
{
super.release();
this.panelBorder = null;
this.panelBgcolor = null;
}
public String getPanelBgcolor()
{
return panelBgcolor;
}
public void setPanelBgcolor(String panelBgcolor)
{
this.panelBgcolor = panelBgcolor;
}
public String getPanelBorder()
{
return panelBorder;
}
public void setPanelBorder(String panelBorder)
{
this.panelBorder = panelBorder;
}
}

View File

@@ -1180,6 +1180,89 @@
</attribute>
</tag>
<tag>
<name>imagePickerRadioPanel</name>
<tag-class>org.alfresco.web.ui.common.tag.ImagePickerRadioPanelTag</tag-class>
<body-content>JSP</body-content>
<description>
This component simply renders the image picker component inside a rounded
corner panel.
</description>
<attribute>
<name>panelBorder</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>panelBgcolor</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>id</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>value</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>spacing</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>columns</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>onclick</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>configSection</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<name>convertXMLDate</name>
<tag-class>org.alfresco.web.ui.common.tag.XMLDateConverterTag</tag-class>

View File

@@ -204,6 +204,12 @@
<renderer-class>org.alfresco.web.ui.common.renderer.ImagePickerRadioRenderer</renderer-class>
</renderer>
<renderer>
<component-family>org.alfresco.faces.ImagePicker</component-family>
<renderer-type>org.alfresco.faces.RadioPanel</renderer-type>
<renderer-class>org.alfresco.web.ui.common.renderer.ImagePickerRadioPanelRenderer</renderer-class>
</renderer>
<renderer>
<component-family>javax.faces.Messages</component-family>
<renderer-type>org.alfresco.faces.Errors</renderer-type>

View File

@@ -101,13 +101,12 @@
</td>
<td>
<table border="0" cellpadding="0" cellspacing="0"><tr><td>
<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "blue", "#D3E6FE"); %>
</f:verbatim>
<a:imagePickerRadio id="space-icon" columns="6" spacing="4" value="#{DialogManager.bean.icon}" >
<a:imagePickerRadioPanel id="space-icon" columns="6" spacing="4" value="#{DialogManager.bean.icon}"
panelBorder="blue" panelBgcolor="#D3E6FE">
<a:listItems value="#{DialogManager.bean.icons}" />
</a:imagePickerRadio>
</a:imagePickerRadioPanel>
<f:verbatim>
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "blue"); %>
</td></tr></table>
</td>
</tr>

View File

@@ -113,13 +113,14 @@
<f:verbatim>
</td>
<td>
<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "blue", "#D3E6FE"); %>
<table border="0" cellpadding="0" cellspacing="0"><tr><td>
</f:verbatim>
<a:imagePickerRadio id="space-icon" columns="6" spacing="4" value="#{WizardManager.bean.icon}">
<a:imagePickerRadioPanel id="space-icon" columns="6" spacing="4" value="#{WizardManager.bean.icon}"
panelBorder="blue" panelBgcolor="#D3E6FE">
<a:listItems value="#{WizardManager.bean.icons}" />
</a:imagePickerRadio>
</a:imagePickerRadioPanel>
<f:verbatim>
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "blue"); %>
</td></tr></table>
</td>
</tr>
<%--

View File

@@ -33,14 +33,12 @@
</tr>
<tr>
<td>
<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "blue", "#D3E6FE"); %>
</f:verbatim>
<a:imagePickerRadio id="space-type" columns="4" spacing="4" value="#{WizardManager.bean.spaceType}"
onclick="javascript:itemSelected(this);">
<a:imagePickerRadioPanel id="space-type" columns="4" spacing="4" value="#{WizardManager.bean.spaceType}"
onclick="javascript:itemSelected(this);" panelBorder="blue" panelBgcolor="#D3E6FE">
<a:listItems value="#{WizardManager.bean.folderTypes}" />
</a:imagePickerRadio>
</a:imagePickerRadioPanel>
<f:verbatim>
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "blue"); %>
</td>
</tr>
<tr>