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

@@ -70,8 +70,6 @@ public class PropertySheetItemRenderer extends BaseRenderer
UIComponent label = children.get(0);
UIComponent control = children.get(1);
out.write("</td>");
// encode the mandatory marker component if present
if (count == 3)
{

View File

@@ -0,0 +1,90 @@
/*
* 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.renderer.property;
import java.io.IOException;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.renderer.BaseRenderer;
/**
* Renderer for a Separator component
*
* @author gavinc
*/
public class SeparatorRenderer extends BaseRenderer
{
/**
* @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;
}
// NOTE: we close off the first <td> generated by the property sheet's grid renderer
context.getResponseWriter().write("</td>");
}
/**
* @see javax.faces.render.Renderer#encodeChildren(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
*/
@SuppressWarnings("unchecked")
public void encodeChildren(FacesContext context, UIComponent component) throws IOException
{
if (component.isRendered() == false)
{
return;
}
ResponseWriter out = context.getResponseWriter();
int count = component.getChildCount();
if (count == 1)
{
// there should be 3 columns so write out a td with colspan of 3
// then render the child component
out.write("<td colspan='3'>");
Utils.encodeRecursive(context, (UIComponent)component.getChildren().get(0));
// NOTE: we'll allow the property sheet's grid renderer close off the last <td>
}
}
/**
* @see javax.faces.render.Renderer#encodeEnd(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
*/
public void encodeEnd(FacesContext context, UIComponent component) throws IOException
{
// we don't need to do anything in here
}
/**
* @see javax.faces.render.Renderer#getRendersChildren()
*/
public boolean getRendersChildren()
{
return true;
}
}