Author: ssmiweve Date: 2009-01-28 11:35:30 +0100 (Wed, 28 Jan 2009) New Revision: 7175
Modified: branches/2.18/view-config-spi/src/main/java/no/sesat/search/view/config/SearchTab.java branches/2.18/views.xsd Log: Issue SKER5045: (views.xml: move attributes from tab element to layout element) Modified: branches/2.18/view-config-spi/src/main/java/no/sesat/search/view/config/SearchTab.java =================================================================== --- branches/2.18/view-config-spi/src/main/java/no/sesat/search/view/config/SearchTab.java 2009-01-27 22:42:54 UTC (rev 7174) +++ branches/2.18/view-config-spi/src/main/java/no/sesat/search/view/config/SearchTab.java 2009-01-28 10:35:30 UTC (rev 7175) @@ -1,4 +1,4 @@ -/* Copyright (2006-2008) Schibsted Søk AS +/* Copyright (2006-2009) Schibsted Søk AS * This file is part of SESAT. * * SESAT is free software: you can redistribute it and/or modify @@ -24,13 +24,14 @@ import java.io.Serializable; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import no.sesat.search.site.config.AbstractDocumentFactory; import no.sesat.search.view.navigation.NavigationConfig; -import org.apache.log4j.Logger; import org.w3c.dom.Element; import org.w3c.dom.NodeList; @@ -48,7 +49,7 @@ public static final String PARAMETER_KEY = "c"; - private static final Logger LOG = Logger.getLogger(SearchTab.class); + //private static final Logger LOG = Logger.getLogger(SearchTab.class); // Attributes ---------------------------------------------------- @@ -299,6 +300,8 @@ /** * Getter for property displayCss * @return + * + * @deprecated css definitions belong against the layout. */ public boolean isDisplayCss() { return displayCss; @@ -369,6 +372,8 @@ /** * Getter for property css. * @return Value of property css. + * + * @deprecated css definitions belong against the layout. */ public List<String> getCss() { return Collections.unmodifiableList(css); @@ -377,6 +382,8 @@ /** * Getter for property javascript. * @return Value of property javascript. + * + * @deprecated javascript definitions belong against the layout. */ public List<String> getJavascript() { return Collections.unmodifiableList(javascript); @@ -546,11 +553,17 @@ private Map<String,String> properties; private String contentType; private int expires = -1; + private boolean displayCss; + private final List<String> css = new ArrayList<String>(); + private final List<String> javascript = new ArrayList<String>(); private Layout(){} - /** + /** Copy constructor. Used when inheriting from another Layout. * + * Two fields cannot be inherited, id and origin. + * These must be explicitly set on each instance. + * * @param inherit */ public Layout(final Layout inherit){ @@ -563,27 +576,22 @@ properties = inherit.properties; contentType = inherit.contentType; expires = inherit.expires; + displayCss = inherit.displayCss; + css.addAll(inherit.css); + javascript.addAll(inherit.javascript); } } - /** - * - * @return - */ public String getId(){ return id; } - /** - * - * @return - */ public Map<String,String> getIncludes(){ return includes; } - /** + /** Get the include with the given key. * * @param key * @return @@ -593,15 +601,11 @@ return includes.get(key); } - /** - * - * @return - */ public Map<String,String> getProperties(){ return properties; } - /** + /** Get the property with the given key * * @param key * @return @@ -612,23 +616,16 @@ /** * @return - @deprecated **/ + * @deprecated no need to use this anymore. + **/ public String getOrigin(){ return origin; } - /** - * - * @return - */ public String getMain(){ return main; } - /** - * - * @return - */ public String getFront(){ return front; } @@ -651,6 +648,30 @@ return expires; } + /** + * Getter for property displayCss + * @return + */ + public boolean isDisplayCss() { + return displayCss; + } + + /** + * Getter for property css. + * @return Value of property css. + */ + public List<String> getCss() { + return Collections.unmodifiableList(css); + } + + /** + * Getter for property javascript. + * @return Value of property javascript. + */ + public List<String> getJavascript() { + return Collections.unmodifiableList(javascript); + } + /** Will return null when the element argument is null. * Otherwise returns the Layout object deserialised from the contents of the Element. ** @param element @@ -678,6 +699,22 @@ if(0 < element.getAttribute("expires-in-seconds").length()){ expires = Integer.parseInt(element.getAttribute("expires-in-seconds")); } + if(0 < element.getAttribute("display-css").length()){ + displayCss = Boolean.parseBoolean(element.getAttribute("display-css")); + } + + final String allCss = AbstractDocumentFactory.parseString(element.getAttribute("css"), null); + final String[] cssArr = allCss != null ? allCss.split(",") : new String[]{}; + + css.addAll(Arrays.asList(cssArr)); + + final String allJavascript + = AbstractDocumentFactory.parseString(element.getAttribute("javascript"), null); + final String[] jsArr = allJavascript != null ? allJavascript.split(",") : new String[]{}; + + + javascript.addAll(Arrays.asList(jsArr)); + includes = readMap(includes, element.getElementsByTagName("include"), "key", "template"); properties = readMap(properties, element.getElementsByTagName("property"), "key", "value"); } Modified: branches/2.18/views.xsd =================================================================== --- branches/2.18/views.xsd 2009-01-27 22:42:54 UTC (rev 7174) +++ branches/2.18/views.xsd 2009-01-28 10:35:30 UTC (rev 7175) @@ -40,6 +40,9 @@ <xsd:attribute name='front'/> <xsd:attribute name='content-type'/> <xsd:attribute name='expires-in-seconds' type="xsd:integer"/> + <xsd:attribute name='display-css'/> + <xsd:attribute name='css'/> + <xsd:attribute name='javascript'/> </xsd:complexType> <xsd:complexType name='include'> <xsd:attribute name='key'/> @@ -78,6 +81,7 @@ <xsd:attribute name='id'/> <xsd:attribute name='command-name'/> <xsd:attribute name='page-size'/> + <xsd:attribute name='multiple-page-size'/> <xsd:attribute name='number-of-pages'/> <xsd:attribute name='hitcount-source'/> </xsd:complexType> _______________________________________________ Kernel-commits mailing list Kernel-commits@sesat.no http://sesat.no/mailman/listinfo/kernel-commits