Index: src/java/org/displaytag/tags/TableTag.java
===================================================================
RCS file: /cvsroot/displaytag/displaytag2/src/java/org/displaytag/tags/TableTag.java,v
retrieving revision 1.52
diff -u -r1.52 TableTag.java
--- src/java/org/displaytag/tags/TableTag.java	11 Mar 2004 22:18:57 -0000	1.52
+++ src/java/org/displaytag/tags/TableTag.java	5 Apr 2004 13:13:13 -0000
@@ -153,6 +153,7 @@
      * table decorator class name - cleaned in doEndTag().
      */
     private String decoratorName;
+    private String decoratorDdName;
 
     /**
      * page size - reset in doEndTag().
@@ -418,7 +419,18 @@
      */
     public void setDecorator(String decorator)
     {
-        this.decoratorName = decorator;
+    	String[] d = decorator.split(",");
+    	if (d.length == 1) {
+    		this.decoratorName = d[0];
+    	}
+    	if (d.length == 2) {
+    		if (!"highlightSelectedRow".equalsIgnoreCase(d[0])) {
+    			// This allows us to use a decorator in combination with highlighting of selected row.
+    			this.decoratorName = d[0];
+    		}
+    		this.decoratorDdName = d[1];
+    	}
+    	else this.decoratorName = decorator;
     }
 
     /**
@@ -1434,11 +1446,15 @@
      */
     private String getTableBody() throws ObjectLookupException, DecoratorException
     {
+        boolean hasDecoratedSelectedRow = false;
+    	
         StringBuffer buffer = new StringBuffer();
 
         // Ok, start bouncing through our list...
         RowIterator rowIterator = this.tableModel.getRowIterator();
 
+        String drillDownParam = decoratorDdName + "=" + getPageContext().getRequest().getParameter(decoratorDdName);
+        
         // iterator on rows
         while (rowIterator.hasNext())
         {
@@ -1447,15 +1463,18 @@
             {
                 log.debug("[" + getId() + "] rowIterator.next()=" + row);
             }
-            if (this.tableModel.getTableDecorator() != null)
-            {
-                String stringStartRow = this.tableModel.getTableDecorator().startRow();
-                if (stringStartRow != null)
-                {
-                    buffer.append(stringStartRow);
-                }
-            }
+            
+            ColumnIterator columnIterator = row.getColumnIterator(this.tableModel.getHeaderCellList());
 
+    		// Loop through column data to find out if a row should be decorated with 'selectedRow' styleclass
+            boolean currentRowIsSelectedRow = false;
+            if (!hasDecoratedSelectedRow) {
+            	currentRowIsSelectedRow = decorateRow(drillDownParam, row, columnIterator);
+            	if (currentRowIsSelectedRow) {
+            		hasDecoratedSelectedRow = true;
+            	}
+            }
+            
             // open tr
             buffer.append(row.getOpenTag());
 
@@ -1464,11 +1483,17 @@
             {
                 log.debug("[" + getId() + "] creating ColumnIterator on " + this.tableModel.getHeaderCellList());
             }
-            ColumnIterator columnIterator = row.getColumnIterator(this.tableModel.getHeaderCellList());
+            columnIterator = row.getColumnIterator(this.tableModel.getHeaderCellList());
 
             while (columnIterator.hasNext())
             {
                 Column column = columnIterator.nextColumn();
+                // Set styleclass for <td> tag.
+                if (currentRowIsSelectedRow) {
+                	column.setStyle("selectedRow");
+                } else {
+                	column.setStyle(this.tableModel.getProperties().getCssRow(this.rowNumber));
+                }
 
                 // Get the value to be displayed for the column
                 buffer.append(column.getOpenTag());
@@ -1511,14 +1536,40 @@
 
         if (this.tableModel.getRowListPage().size() == 0)
         {
-            buffer.append("<tr class=\"empty\"><td colspan=\"" + (this.tableModel.getNumberOfColumns()) + "\">"
+        	//String clazz = decoratorDdName!=null ? decoratorDdName : "empty";
+        	String clazz = "empty";
+            buffer.append("<tr class=\"" + clazz + "\"><td colspan=\"" + (this.tableModel.getNumberOfColumns()) + "\">"
                 + this.properties.getEmptyListMessage() + "</td></tr>");
         }
 
         return buffer.toString();
     }
 
-    /**
+	/*
+	 * Loop through column data to find out if row should be decorated with 'selectedRow' styleclass
+	 */
+    private boolean decorateRow(String drillDownParam, Row row, ColumnIterator columnIterator) throws ObjectLookupException, DecoratorException {
+		if (drillDownParam!=null) {
+		    while (columnIterator.hasNext()) {
+		        Column column = columnIterator.nextColumn();
+		        column.getOpenTag();// Must be called
+		        String value = column.getChoppedAndLinkedValue();
+		        if (value.indexOf(drillDownParam)!=-1) {
+		        	/*int lastPos = value.indexOf(drillDownParam)+drillDownParam.length();
+		        	System.out.println("###:" + value.charAt(lastPos) + value.charAt(lastPos+1));*/
+		    		row.setDecoratSelectedRow(true);
+		    		return true;
+		        	/*if (lastPos < value.length()) {
+		        		if (value.charAt(lastPos)=='"') {
+		        		}
+		        	}*/
+		        }
+		    }
+		}
+		return false;
+	}
+
+	/**
      * Generates table footer with links for export commands.
      * @return String
      */
