Java Code Examples for javax.faces.component.UIComponent

The following examples show how to use javax.faces.component.UIComponent. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: yawl   Source File: DynFormFactory.java    License: GNU Lesser General Public License v3.0 6 votes vote down vote up
private String getStyle(UIComponent component) {
    String style = "";
    if ((component instanceof Label))
        style = ((Label) component).getStyle();
    else if ((component instanceof SelectorBase))
        style = ((SelectorBase) component).getStyle();
    else if ((component instanceof FieldBase))
        style = ((FieldBase) component).getStyle();
    else if ((component instanceof FlatPanel))
        style = ((FlatPanel) component).getStyle();
    else if ((component instanceof StaticText))
        style = ((StaticText) component).getStyle();
    else if ((component instanceof ImageComponent))
        style = ((ImageComponent) component).getStyle();
    else if ((component instanceof DocComponent))
        style = ((DocComponent) component).getStyle();
    return style;
}
 
Example 2
Source Project: development   Source File: DurationConverter.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Conversion to server representation, so converting days to milliseconds.
 * Prior to the conversion the input value is validated.
 */
@Override
public Object getAsObject(FacesContext context, UIComponent component,
        String value) {
    try {
        // Checks if mandatory and not empty
        new ParameterValueValidator().validate(context, component, value);
    } catch (ValidatorException e) {
        throw new ConverterException(e.getFacesMessage());
    }

    // Validation passed; so if the value is empty it's not mandatory
    if (value == null || value.trim().length() == 0) {
        return null;
    } else {
        Long durationInMs = DurationValidation.convertDurationToMs(context,
                value);
        if (durationInMs != null) {
            return durationInMs.toString();
        } else {
            throw new ConverterException(
                    ParameterValueValidator.getFacesMessage(component,
                            context));
        }
    }
}
 
Example 3
Source Project: sakai   Source File: RendererUtil.java    License: Educational Community License v2.0 6 votes vote down vote up
/**
 * Sets component attribute value - if a ValueBinding exists for that
 * attribute, set through the binding; otherwise, set the value directly on
 * the component.
 */
public static void setAttribute(FacesContext context, UIComponent component, String name,
        Object value)
{
    ValueBinding binding = component.getValueBinding(name);
    if (binding != null)
    {
        try
        {
            binding.setValue(context, value);
        } catch (IllegalArgumentException e)
        {
            // try setting the value as a String
            binding.setValue(context, String.valueOf(value));
        }
    } else
    {
        component.getAttributes().put(name, value);
    }
}
 
Example 4
Source Project: sakai   Source File: TagUtil.java    License: Educational Community License v2.0 6 votes vote down vote up
/**
 * Set a MethodBinding on a component - used by tags setProperties() method.
 */
public static void setMethodBinding(UIComponent component, String name, String value,
        Class[] paramTypes)
{
    if (value == null)
    {
        return;
    }
    if (UIComponentTag.isValueReference(value))
    {
        FacesContext context = FacesContext.getCurrentInstance();
        Application app = context.getApplication();
        MethodBinding mb = app.createMethodBinding(value, paramTypes);
        component.getAttributes().put(name, mb);
    }
}
 
Example 5
Source Project: oxTrust   Source File: FacesComponentUtility.java    License: MIT License 6 votes vote down vote up
public static void dumpComponentsTree(List<UIComponent> componetns, int level) {
	if ((componetns == null) || (componetns.size() == 0)) {
		return;
	}

	StringBuffer levelString = new StringBuffer();
	for (int i = 0; i < level; i++) {
		levelString.append(" ");
	}

	for (UIComponent comp : componetns) {
		System.out.println(levelString + comp.getId());
		if (comp.getChildCount() > 0) {
			dumpComponentsTree(comp.getChildren(), level++);
		}
	}
}
 
Example 6
Source Project: BootsFaces-OSP   Source File: AJAXRenderer.java    License: Apache License 2.0 6 votes vote down vote up
private static String encodeClick(UIComponent component) {
	String js;
	String oc = null;
	if (component instanceof IAJAXComponent) {
		oc = ((IAJAXComponent) component).getOnclick();
	}
	if (component instanceof NavLink) {
		oc = ((NavLink) component).getOnclick();
	}
	if (component instanceof NavCommandLink) {
		oc = ((NavCommandLink) component).getOnclick();
	}
	if (oc != null) {
		js = oc.endsWith(";") ? oc : oc + ";";
		if (js.contains("return ")) {
			js = "if (false===(function() {" + js + "})()) return false;";
		}
	} else {
		js = "";
	}

	return js;
}
 
Example 7
Source Project: XPagesExtensionLibrary   Source File: ForumPostRenderer.java    License: Apache License 2.0 6 votes vote down vote up
protected void writePostTitle(FacesContext context, ResponseWriter w, UIForumPost c, UIComponent facet) throws IOException {
    if(facet==null) {
        return;
    }
    w.startElement("div", c); // $NON-NLS-1$
    String style = (String)getProperty(PROP_POSTTITLESTYLE);
    if(StringUtil.isNotEmpty(style)) {
        w.writeAttribute("style", style, null); // $NON-NLS-1$
    }
    String styleClass = (String)getProperty(PROP_POSTTITLECLASS);
    if(StringUtil.isNotEmpty(styleClass)) {
        w.writeAttribute("class", styleClass, null); // $NON-NLS-1$
    }
    FacesUtil.renderComponent(context, facet);
    w.endElement("div"); // $NON-NLS-1$
}
 
Example 8
Source Project: XPagesExtensionLibrary   Source File: FormTableRenderer.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void writeHeaderFacet(FacesContext context, ResponseWriter w, FormLayout c, UIComponent header) throws IOException {
    w.startElement("tr", c); // $NON-NLS-1$
    w.startElement("td", c); // $NON-NLS-1$
    String style = (String)getProperty(PROP_STYLEHEADER);
    if(StringUtil.isNotEmpty(style)) {
        w.writeAttribute("style", style, null); // $NON-NLS-1$
    }
    String cls = (String)getProperty(PROP_STYLECLASSHEADER);
    if(StringUtil.isNotEmpty(cls)) {
        w.writeAttribute("class", cls, null); // $NON-NLS-1$
    }
    w.writeAttribute("colspan", "3", null); // $NON-NLS-1$
    
    writeHeaderFacetContext(context, w, c, header);
    
    w.endElement("td"); // $NON-NLS-1$
    w.endElement("tr"); // $NON-NLS-1$
}
 
Example 9
public void encodeChildren(FacesContext context, UIComponent component)
	throws IOException
{
  if (!component.isRendered())
  {
    return;
  }

  Iterator children = component.getChildren().iterator();
  while (children.hasNext()) {
    UIComponent child = (UIComponent) children.next();
    if(!((child instanceof org.sakaiproject.tool.messageforums.jsf.BarLinkComponent)||
        (child instanceof HtmlOutputText)))
    {
      child.encodeBegin(context);
      child.encodeChildren(context);
      child.encodeEnd(context);
    }
  }
}
 
Example 10
Source Project: development   Source File: LongValidator.java    License: Apache License 2.0 6 votes vote down vote up
private static void validate(FacesContext context, UIComponent uiComponent,
        String value) throws ValidatorException {
    Long minValue = getMinValue(uiComponent);
    Long maxValue = getMaxValue(uiComponent);
    long parsedLong = parse(context, value, minValue, maxValue);
    if (!isInRange(parsedLong, minValue, maxValue)) {
        minValue = (minValue != null ? minValue : Long
                .valueOf(Long.MIN_VALUE));
        maxValue = (maxValue != null ? maxValue : Long
                .valueOf(Long.MAX_VALUE));
        String message = JSFUtils.getText(
                BaseBean.ERROR_LONG_VALUE_OUT_OF_RANGE,
                new String[] { String.valueOf(minValue),
                        String.valueOf(maxValue) }, context);
        throw getException(message);
    }
}
 
Example 11
Source Project: sakai   Source File: Tags.java    License: Educational Community License v2.0 5 votes vote down vote up
public static void setMethodBinding(UIComponent component,
		String attributeName, String attributeValue, Class[] paramTypes) {
	if (attributeValue == null)
		return;
	if (UIComponentTag.isValueReference(attributeValue)) {
		FacesContext context = FacesContext.getCurrentInstance();
		Application app = context.getApplication();
		MethodBinding mb = app.createMethodBinding(attributeValue, paramTypes);
		component.getAttributes().put(attributeName, mb);
	}
}
 
Example 12
Source Project: BootsFaces-OSP   Source File: TabRepeat.java    License: Apache License 2.0 5 votes vote down vote up
private boolean visitChildren(VisitContext context, VisitCallback callback) {
	Integer begin = this.getBegin();
	Integer end = this.getEnd();
	Integer step = this.getStep();

	int rowCount = getDataModel().getRowCount();
	int i = ((begin != null) ? begin : 0);
	int e = ((end != null) ? end : rowCount);
	int s = ((step != null) ? step : 1);
	validateIterationControlValues(rowCount, i, e);
	FacesContext faces = context.getFacesContext();
	this.setIndex(faces, i);
	this.updateIterationStatus(faces, new IterationStatus(true, (i + s > e || rowCount == 1), i, begin, end, step));
	while (i < e && this.isIndexAvailable()) {

		this.setIndex(faces, i);
		this.updateIterationStatus(faces, new IterationStatus(false, i + s >= e, i, begin, end, step));
		for (UIComponent kid : getChildren()) {
			if (kid.visitTree(context, callback)) {
				return true;
			}
		}
		i += s;
	}

	return false;
}
 
Example 13
Source Project: sakai   Source File: PagerRenderer.java    License: Educational Community License v2.0 5 votes vote down vote up
/** 
 * Get a named attribute from the component or the widget resource bundle.
 * @return The attribute value if it exists in the given component,
 * or the attribute value from this widget's resource bundle, or 
 * the default if none of those exists.
 */
private static String getString(FacesContext context, UIComponent component, String attrName, String def)
{
	String ret = (String) getFromAttributeOrBundle(context, component, attrName);
	if (ret != null) return ret;
	
	// otherwise, return the default
	return def;
}
 
Example 14
@Override
protected void initDojoAttributes(FacesContext context, FacesDojoComponent dojoComponent, Map<String,String> attrs) throws IOException {
    super.initDojoAttributes(context, dojoComponent, attrs);
    if(dojoComponent instanceof UIDojoTabPane) {
        UIDojoTabPane c = (UIDojoTabPane)dojoComponent;

        String tabKey = c.getTabUniqueKey();
        if(StringUtil.isEmpty(tabKey)) {
            tabKey = c.getId();
        }
        
        // Find if the pane is selected
        boolean selected = false;
        UIComponent p = c.getParent();
        if(p instanceof UIDojoTabContainer) {
            String sel = ((UIDojoTabContainer)p).getSelectedTab();
            selected = StringUtil.equals(sel, tabKey);
        }
        if(selected) {
            DojoRendererUtil.addDojoHtmlAttributes(attrs,"selected",true); // $NON-NLS-1$
        }

        DojoRendererUtil.addDojoHtmlAttributes(attrs,"closable",c.isClosable()); // $NON-NLS-1$
        DojoRendererUtil.addDojoHtmlAttributes(attrs,"title",c.getTitle()); // $NON-NLS-1$
        DojoRendererUtil.addDojoHtmlAttributes(attrs,"tabUniqueKey",tabKey); // $NON-NLS-1$
        DojoRendererUtil.addDojoHtmlAttributes(attrs,"onClose",c.getOnClose()); // $NON-NLS-1$
    }
}
 
Example 15
public static void addHiddenFieldsForParametersIfNotExists(FacesContext context, UIComponent parentComponent,
        List<UIParameter> uiParameters) throws IOException {

    UIForm parentForm = findForm(parentComponent);
    String parentFormClientId = parentForm.getClientId(context);
    ResponseWriter writer = context.getResponseWriter();
    HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();

    for (int i = 0; i < uiParameters.size(); i++) {
        UIParameter parameter = uiParameters.get(i);
        addHiddenFieldForParameterIfNotExists(parentFormClientId, request, writer, parameter.getName());
    }
}
 
Example 16
protected void writeFooterPagerArea(FacesContext context, ResponseWriter w, AbstractDataView c, ViewDefinition viewDef, UIComponent pagerBottom, UIComponent pagerBottomLeft, UIComponent pagerBottomRight) throws IOException {
    String tag = (String)getProperty(PROP_FOOTER_PAGER_AREA_TAG);
    if(StringUtil.isNotEmpty(tag)) {
        startElement(w, tag, PROP_FOOTERSTYLE, PROP_FOOTERCLASS, PROP_FOOTERDOJOTYPE);
    }
    writeFooterLeft(context, w, c, viewDef, pagerBottomLeft);
    writeFooterMiddle(context, w, c, viewDef, pagerBottom);
    writeFooterRight(context, w, c, viewDef, pagerBottomRight);
    if(StringUtil.isNotEmpty(tag)) {
        w.endElement(tag);
    }
    newLine(w);
}
 
Example 17
Source Project: sakai   Source File: UploadRenderer.java    License: Educational Community License v2.0 5 votes vote down vote up
public void encodeBegin(FacesContext context, UIComponent component)
		throws IOException {
	if (!component.isRendered())
		return;
	ResponseWriter writer = context.getResponseWriter();

	String clientId = component.getClientId(context);

	writer.startElement("input", component);
	writer.writeAttribute("type", "file", "type");
	writer.writeAttribute("name", clientId, "clientId");
	writer.endElement("input");
	writer.flush();
}
 
Example 18
Source Project: sakai   Source File: ShowAreaTag.java    License: Educational Community License v2.0 5 votes vote down vote up
public static void setString(UIComponent component, String attributeName,
    String attributeValue)
{
  if (attributeValue == null) return;
  if (UIComponentTag.isValueReference(attributeValue)) setValueBinding(
      component, attributeName, attributeValue);
  else
    component.getAttributes().put(attributeName, attributeValue);
}
 
Example 19
Source Project: BootsFaces-OSP   Source File: JumbotronRenderer.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * This methods generates the HTML code of the current b:jumbotron.
* <code>encodeBegin</code> generates the start of the component. After the, the JSF framework calls <code>encodeChildren()</code>
* to generate the HTML code between the beginning and the end of the component. For instance, in the case of a panel component
* the content of the panel is generated by <code>encodeChildren()</code>. After that, <code>encodeEnd()</code> is called
* to generate the rest of the HTML code.
 * @param context the FacesContext.
 * @param component the current b:jumbotron.
 * @throws IOException thrown if something goes wrong when writing the HTML code.
 */  
@Override
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
    if (!component.isRendered()) {
        return;
    }
	Jumbotron jumbotron = (Jumbotron) component;
	ResponseWriter rw = context.getResponseWriter();
	endDisabledFieldset(jumbotron, rw);
	rw.endElement("div");
	Tooltip.activateTooltips(context, jumbotron);
}
 
Example 20
Source Project: BootsFaces-OSP   Source File: ELTools.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Which annotations are given to an object described by an EL expression?
 *
 * @param p_expression
 *            EL expression of the JSF bean attribute
 * @return null if there are no annotations, or if they cannot be accessed
 */
public static Annotation[] readAnnotations(ValueExpression p_expression, UIComponent p_component) {
	FacesContext context = FacesContext.getCurrentInstance();
	ELContext elContext = context.getELContext();
	try {
		ValueReference valueReference = p_expression.getValueReference(elContext);
		Object base;
		if (null == valueReference) {
			base = evaluteBaseForMojarra(elContext, p_expression);
		} else {
			base = valueReference.getBase();
		}
		if (null == base) {
			return null;
		}
		Field declaredField = getField(base, p_expression.getExpressionString());
		if (null != declaredField) {
			return declaredField.getAnnotations();
		}
		Method getter = getGetter(base, p_expression.getExpressionString());
		if (null != getter) {
			return getter.getAnnotations();
		}
	} catch (PropertyNotFoundException ex) {
		// this happens if a bean is null. That's a legal state, so suffice it to return no annotation.
	}
	return null;
}
 
Example 21
Source Project: development   Source File: DurationConverterTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testGetAsObjectDecimalSeparator() throws ConverterException {
    UIComponent component = ConverterTestHelper.getComponent(false, null,
            null, "duration");
    Object result = converter.getAsObject(context, component, "1,00");
    Assert.assertTrue(result instanceof String);
    Assert.assertEquals(
            String.valueOf(DurationValidation.MILLISECONDS_PER_DAY * 100),
            result);
}
 
Example 22
Source Project: BootsFaces-OSP   Source File: ValueExpressionHelper.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Source adapted from Seam's enumConverter. The goal is to get the type to which this component's value is bound.
 * First, check if the valueExpression provides the type. For dropdown-like components, this may not work, so check
 * for SelectItems children.
 * 
 * @param context the current FacesContext
 * @param uiComponent
 * @param validTypes a list of types to look for
 * @return null if a valid type cannot be found
 */
public static Class<?> getValueType(FacesContext context, UIComponent uiComponent, Collection<Class<?>> validTypes) {
	Class<?> valueType = getValueType(context, uiComponent);
	if (valueType != null && isValid(validTypes, valueType)) {
		return valueType;
	}
	else {
		for (UIComponent child : uiComponent.getChildren()) {
			UIComponent c = (UIComponent) child;
			ValueExpression expr = c.getValueExpression("value");
			Object val = expr == null ? null : expr.getValue(context.getELContext());
			if (val != null) {

				valueType = val.getClass();
				if (valueType.isArray() && isValid(validTypes, valueType.getComponentType())) {
					return valueType;
				}
				else if (val instanceof Collection<?>) {
					valueType = ((Collection<?>) val).iterator().next().getClass();
					if (isValid(validTypes, valueType)) {
						return valueType;
					}
				}
			}
		}
	}
	return null;
}
 
Example 23
protected void writeHeaderMiddle(FacesContext context, ResponseWriter w, AbstractDataView c, ViewDefinition viewDef, UIComponent facet) throws IOException {
    if(facet!=null) {
        String tag = (String)getProperty(PROP_FACETTAG);
        if(StringUtil.isNotEmpty(tag)) {
            startElement(w, tag, PROP_HEADERMIDDLESTYLE, PROP_HEADERMIDDLECLASS, null);
        }
        FacesUtil.renderComponent(context, facet);
        if(StringUtil.isNotEmpty(tag)) {
            w.endElement(tag);
        }
        newLine(w);
    }
}
 
Example 24
Source Project: sakai   Source File: ToolBarTag.java    License: Educational Community License v2.0 5 votes vote down vote up
protected void setProperties(UIComponent component)
{

  super.setProperties(component);

  FacesContext context = getFacesContext();
  TagUtil.setString(component, "separator", separator);
}
 
Example 25
Source Project: sakai   Source File: DivMessageRenderer.java    License: Educational Community License v2.0 5 votes vote down vote up
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
	// Note our complete disregard for class cast and null exceptions....
	UIMessage uiMessage = (UIMessage)component;
	String clientId = uiMessage.findComponent(uiMessage.getFor()).getClientId(context);

	Iterator iter = context.getMessages(clientId);
	if (iter.hasNext()) {
		// Just do the first one.
		FacesMessage message = (FacesMessage)iter.next();
		renderMessage(context, component, message);
	}
}
 
Example 26
@Override
public void encodeChildren(FacesContext context, UIComponent component) throws IOException {

    UIDataRepeater dataRepeater = (UIDataRepeater) component;

    int first = dataRepeater.getFirst();
    int rows = dataRepeater.getRows();
    int rowCount = dataRepeater.getRowCount();

    if (rows <= 0) {
        rows = rowCount - first;
    }

    int last = first + rows;

    if (last > rowCount) {
        last = rowCount;
    }

    for (int i = first; i < last; i++) {
        dataRepeater.setRowIndex(i);
        if (dataRepeater.isRowAvailable()) {
            if (dataRepeater.getChildCount() > 0) {
                for (Iterator it = dataRepeater.getChildren().iterator(); it.hasNext();) {
                    UIComponent child = (UIComponent) it.next();
                    // For some reason its necessary to touch Id property,
                    // otherwise
                    // the child control will not call getClientId on parent
                    // (NamingContainer)
                    child.setId(child.getId());
                    encodeRecursive(context, child);
                }
            }

        }
    }
}
 
Example 27
Source Project: XPagesExtensionLibrary   Source File: DialogRenderer.java    License: Apache License 2.0 5 votes vote down vote up
public void placeHolderEncodeBegin(FacesContext context, UIComponent component) throws IOException {
    if (!component.isRendered()) {
        return;
    }
    ResponseWriter w = context.getResponseWriter();
    
    UIDialog dialog = (UIDialog)component;
    
    // Add the dojo module
    UIViewRootEx rootEx = (UIViewRootEx)context.getViewRoot();
    ExtLibResources.addEncodeResource(rootEx, getDefaultDojoModule(context,dialog));

    rootEx.setDojoParseOnLoad(true);
    rootEx.setDojoTheme(true);

    String clientId = component.getClientId(context);
    w.startElement("span", component); // $NON-NLS-1$
    
    Map<String,String> attrs = DojoRendererUtil.createMap(context);
    String dojoType = getPlaceHolderWrapperType(); // $NON-NLS-1$
    attrs.put("dialogId", clientId); // $NON-NLS-1$ $NON-NLS-2$
    DojoRendererUtil.writeDojoHtmlAttributes(context, component, dojoType, attrs);
    
    String style = ExtLibUtil.concatStyles("display:none", dialog.getStyle()); // $NON-NLS-1$
    if(StringUtil.isNotEmpty(style)) {
        w.writeAttribute("style", style, null); // $NON-NLS-1$
    }
    String styleClass = dialog.getStyleClass();
    if(StringUtil.isNotEmpty(styleClass)) {
        w.writeAttribute("class", styleClass, null); // $NON-NLS-1$
    }
    
    w.startElement("span", component); // $NON-NLS-1$
    w.writeAttribute("id", clientId, "id"); // $NON-NLS-1$ $NON-NLS-2$
    w.endElement("span"); // $NON-NLS-1$
    
    w.endElement("span"); // $NON-NLS-1$
}
 
Example 28
public void encodeEnd(FacesContext facesContext, UIComponent component)
		throws IOException {
	if (log.isDebugEnabled()) log.debug("encodeEnd rendering " + component);
	if (!UserRoleUtils.isEnabledOnUserRole(component)) {
           super.encodeEnd(facesContext, component);
       } else {
		HtmlCommandSortHeader sortHeader = (HtmlCommandSortHeader) component;
		HtmlDataTable dataTable = sortHeader.findParentDataTable();

		if (sortHeader.isArrow() && sortHeader.getColumnName().equals(dataTable.getSortColumn())) {
			ResponseWriter writer = facesContext.getResponseWriter();

               writer.write(HTML.NBSP_ENTITY);

               HtmlGraphicImage image = new HtmlGraphicImage();
               if (dataTable.isSortAscending()) {
                   image.setValue("/library/image/sakai/sortascending.gif");
                   image.setAlt(MessageFormat.format(rb.getString("sort_ascending"), sortHeader.getColumnName().toLowerCase()));
			} else {
                   image.setValue("/library/image/sakai/sortdescending.gif");
                   image.setAlt(MessageFormat.format(rb.getString("sort_descending"), sortHeader.getColumnName().toLowerCase()));
			}

               writer.startElement(HTML.IMG_ELEM, image);
               writer.writeURIAttribute("src", image.getValue(), null);
               writer.writeAttribute("alt",image.getAlt().toString(), null);
               writer.endElement(HTML.IMG_ELEM);
		}
           super.encodeEnd(facesContext, component);
	}
}
 
Example 29
Source Project: XPagesExtensionLibrary   Source File: Node.java    License: Apache License 2.0 5 votes vote down vote up
/**
   * @param cl
   * @return
   * @throws ClassNotFoundException
   * @throws IllegalAccessException
   * @throws InstantiationException
   */
  public UIComponent restoreInstance(ClassLoader cl)
          throws ClassNotFoundException, IllegalAccessException,
          InstantiationException {
      Class<?> c = cl.loadClass(_className);
UIComponent comp = (UIComponent) c.newInstance();
comp.setId(_id);
      return comp;
  }
 
Example 30
public String getValueDateTimeAsString(FacesContext context, UIComponent component, Date value) {
DateFormat fmt;
switch(timeDateFmt) {
	case ViewColumn.FMT_DATE: {
   		fmt = com.ibm.commons.util.DateTime.getDefaultDateFormatter();
	} break;
	case ViewColumn.FMT_TIME: {
   		fmt = com.ibm.commons.util.DateTime.getDefaultTimeFormatter();
	} break;
	default: {
   		fmt = com.ibm.commons.util.DateTime.getDefaultDatetimeFormatter();
	} break;
}
return fmt.format(value);
  }