Search in sources :

Example 1 with XMLDateConverter

use of org.alfresco.web.ui.common.converter.XMLDateConverter in project acs-community-packaging by Alfresco.

the class DateTimePickerGenerator method getDefaultConverter.

/**
 * Retrieves the default converter for the date time component
 *
 * @param context FacesContext
 * @return XMLDateConverter
 */
protected Converter getDefaultConverter(FacesContext context) {
    XMLDateConverter converter = (XMLDateConverter) context.getApplication().createConverter(RepoConstants.ALFRESCO_FACES_XMLDATE_CONVERTER);
    converter.setType("both");
    converter.setPattern(Application.getMessage(context, MSG_DATE_TIME));
    return converter;
}
Also used : XMLDateConverter(org.alfresco.web.ui.common.converter.XMLDateConverter)

Example 2 with XMLDateConverter

use of org.alfresco.web.ui.common.converter.XMLDateConverter in project acs-community-packaging by Alfresco.

the class BaseMultiValueRenderer method renderExistingItem.

/**
 * Renders an existing item with a remove button
 *
 * @param context FacesContext
 * @param component The UIComponent
 * @param out Writer to write output to
 * @param nodeService The NodeService
 * @param index The index of the item
 * @param value The item's value
 * @throws IOException
 */
protected void renderExistingItem(FacesContext context, UIComponent component, ResponseWriter out, NodeService nodeService, int index, Object value) throws IOException {
    out.write("<tr><td class='");
    if (this.highlightedRow) {
        out.write("selectedItemsRowAlt");
    } else {
        out.write("selectedItemsRow");
    }
    out.write("'>");
    if (value instanceof NodeRef) {
        String name;
        if (ContentModel.TYPE_CATEGORY.equals(nodeService.getType((NodeRef) value))) {
            name = Repository.getNameForCategoryNode(nodeService, (NodeRef) value);
        } else {
            name = Repository.getNameForNode(nodeService, (NodeRef) value);
        }
        out.write(Utils.encode(name));
    } else if (value instanceof Date) {
        XMLDateConverter converter = (XMLDateConverter) context.getApplication().createConverter(RepoConstants.ALFRESCO_FACES_XMLDATE_CONVERTER);
        UIComponent childComponent = (UIComponent) component.getChildren().get(0);
        Boolean showTime = (Boolean) childComponent.getAttributes().get("showTime");
        if (showTime != null && showTime.booleanValue()) {
            converter.setPattern(Application.getMessage(context, "date_time_pattern"));
        } else {
            converter.setPattern(Application.getMessage(context, "date_pattern"));
        }
        out.write(converter.getAsString(context, childComponent, value));
    } else if (value instanceof Boolean) {
        Converter converter = context.getApplication().createConverter(RepoConstants.ALFRESCO_FACES_BOOLEAN_CONVERTER);
        out.write(converter.getAsString(context, (UIComponent) component.getChildren().get(0), value));
    } else {
        out.write(Utils.encode(value.toString()));
    }
    out.write("&nbsp;&nbsp;");
    out.write("</td><td class='");
    if (this.highlightedRow) {
        out.write("selectedItemsRowAlt");
    } else {
        out.write("selectedItemsRow");
    }
    out.write("'><a href='#' title='");
    out.write(Application.getMessage(context, MSG_REMOVE));
    out.write("' onclick=\"");
    out.write(generateFormSubmit(context, component, UIMultiValueEditor.ACTION_REMOVE + UIMultiValueEditor.ACTION_SEPARATOR + index));
    out.write("\"><img src='");
    out.write(context.getExternalContext().getRequestContextPath());
    out.write("/images/icons/delete.gif' border='0' width='13' height='16'/></a>");
    this.highlightedRow = !this.highlightedRow;
}
Also used : NodeRef(org.alfresco.service.cmr.repository.NodeRef) XMLDateConverter(org.alfresco.web.ui.common.converter.XMLDateConverter) UIComponent(javax.faces.component.UIComponent) XMLDateConverter(org.alfresco.web.ui.common.converter.XMLDateConverter) Converter(javax.faces.convert.Converter) Date(java.util.Date)

Example 3 with XMLDateConverter

use of org.alfresco.web.ui.common.converter.XMLDateConverter in project acs-community-packaging by Alfresco.

the class DatePickerGenerator method getDefaultConverter.

/**
 * Retrieves the default converter for the date component
 *
 * @param context FacesContext
 * @return XMLDateConverter
 */
protected Converter getDefaultConverter(FacesContext context) {
    XMLDateConverter converter = (XMLDateConverter) context.getApplication().createConverter(RepoConstants.ALFRESCO_FACES_XMLDATE_CONVERTER);
    converter.setType("date");
    converter.setPattern(Application.getMessage(context, MSG_DATE));
    return converter;
}
Also used : XMLDateConverter(org.alfresco.web.ui.common.converter.XMLDateConverter)

Aggregations

XMLDateConverter (org.alfresco.web.ui.common.converter.XMLDateConverter)3 Date (java.util.Date)1 UIComponent (javax.faces.component.UIComponent)1 Converter (javax.faces.convert.Converter)1 NodeRef (org.alfresco.service.cmr.repository.NodeRef)1