/* * Copyright (c) 2008,2009 Declarative Engineering LLC. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Declarative Engineering LLC * verson 1 which accompanies this distribution, and is available at * http://declarativeengineering.com/legal/DE_Developer_License_v1.txt */ package com.foundation.web; import com.common.util.ICollection; import com.foundation.web.interfaces.IContent; public abstract class HtmlView implements IHtmlView { /** * Tests the value to retrieve a boolean result. * This method will first try to convert the value to a boolean value, otherwise it will check if it is a collection and use whether it has any values, otherwise it will simply test if the value is non-null. * @param value The value to test. * @param invert Whether to invert the results. * @return Whether the value results in a true value. */ public boolean test(Object value, boolean invert) { boolean result = (value instanceof Boolean ? ((Boolean) value).booleanValue() : value instanceof ICollection ? ((ICollection) value).getSize() > 0 : value != null); return invert ? !result : result; }//test()// /** * Generates the HTML content object. * @return The content for the reponse. */ public IContent generateContent() { return new HtmlContent(generateHtmlSource()); }//generateContent()// }//HtmlView//