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;
}
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(" ");
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;
}
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;
}
Aggregations