You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cl...@apache.org on 2008/03/11 02:28:37 UTC

svn commit: r635773 - /felix/sandbox/clement/ipojo/examples/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/ResultCellRenderer.java

Author: clement
Date: Mon Mar 10 18:28:32 2008
New Revision: 635773

URL: http://svn.apache.org/viewvc?rev=635773&view=rev
Log:
Commit a missing file improving swing runner.

Added:
    felix/sandbox/clement/ipojo/examples/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/ResultCellRenderer.java

Added: felix/sandbox/clement/ipojo/examples/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/ResultCellRenderer.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/ResultCellRenderer.java?rev=635773&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/examples/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/ResultCellRenderer.java (added)
+++ felix/sandbox/clement/ipojo/examples/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/ResultCellRenderer.java Mon Mar 10 18:28:32 2008
@@ -0,0 +1,75 @@
+/*
+ *  Copyright 2008 clement.
+ * 
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ * 
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *  under the License.
+ */
+
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.junit4osgi.command;
+
+import java.awt.Color;
+import java.awt.Component;
+
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableCellRenderer;
+
+/**
+ * Test result renderer.
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class ResultCellRenderer extends DefaultTableCellRenderer {
+
+    /**
+     * UUID.
+     */
+    private static final long serialVersionUID = 1L;
+
+    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
+        Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
+
+        ResultTableModel results = (ResultTableModel) table.getModel();
+        String status = (String) results.getValueAt(row, column);
+        if (status.equals(ResultTableModel.SUCESS)) {
+            c.setForeground(Color.GREEN);
+            setToolTipText(results.getMessage(row, column));
+        }
+        if (status.equals(ResultTableModel.FAILURE)) {
+            c.setForeground(Color.ORANGE);
+            setToolTipText(results.getMessage(row, column));
+        }
+        if (status.equals(ResultTableModel.ERROR)) {
+            c.setForeground(Color.RED);
+            setToolTipText(results.getMessage(row, column));
+        }
+
+        return c;
+    }
+}