no message
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@795 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
BIN
pmd/classes/net/sourceforge/pmd/swingui/icons/TreeClosed.gif
Normal file
BIN
pmd/classes/net/sourceforge/pmd/swingui/icons/TreeClosed.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 890 B |
BIN
pmd/classes/net/sourceforge/pmd/swingui/icons/TreeLeaf.gif
Normal file
BIN
pmd/classes/net/sourceforge/pmd/swingui/icons/TreeLeaf.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 848 B |
BIN
pmd/classes/net/sourceforge/pmd/swingui/icons/TreeOpen.gif
Normal file
BIN
pmd/classes/net/sourceforge/pmd/swingui/icons/TreeOpen.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 914 B |
@ -24,6 +24,7 @@ import javax.swing.table.DefaultTableCellRenderer;
|
||||
import javax.swing.table.JTableHeader;
|
||||
import javax.swing.table.TableColumn;
|
||||
import javax.swing.table.TableColumnModel;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -49,7 +50,7 @@ class DirectoryTable extends JTable
|
||||
setRowSelectionAllowed(false);
|
||||
setColumnSelectionAllowed(false);
|
||||
setCellSelectionEnabled(true);
|
||||
setBackground(PMDLookAndFeel.TABLE_BACKGROUND_COLOR);
|
||||
setBackground(UIManager.getColor("pmdTableBackground"));
|
||||
|
||||
TableColumnModel columnModel = getColumnModel();
|
||||
JTableHeader tableHeader = getTableHeader();
|
||||
|
@ -9,6 +9,7 @@ import javax.swing.Icon;
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.tree.DefaultTreeCellRenderer;
|
||||
import javax.swing.tree.TreePath;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -31,7 +32,7 @@ class DirectoryTree extends JTree
|
||||
setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
|
||||
setCellRenderer(new DirectoryTreeNodeRenderer());
|
||||
((DirectoryTreeModel) getModel()).setDirectoryTree(this);
|
||||
setBackground(PMDLookAndFeel.TREE_BACKGROUND_COLOR);
|
||||
setBackground(UIManager.getColor("pmdTableBackground"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -104,7 +105,7 @@ class DirectoryTree extends JTree
|
||||
m_defaultClosedIcon = getDefaultClosedIcon();
|
||||
m_defaultLeafIcon = getDefaultLeafIcon();
|
||||
m_defaultOpenIcon = getDefaultOpenIcon();
|
||||
setBackgroundNonSelectionColor(PMDLookAndFeel.TREE_BACKGROUND_COLOR);
|
||||
setBackgroundNonSelectionColor(UIManager.getColor("pmdTreeBackground"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -48,12 +48,9 @@ class HTMLResultRenderer
|
||||
//
|
||||
// Write the name of the file that was analyzed.
|
||||
//
|
||||
writer.write("<h3><font color=\"blue\">PMD Analysis Results</font></h3>");
|
||||
writer.write("<font face=\"arial\">");
|
||||
writer.write("<h3><center><font color=\"blue\">PMD Analysis Results</font></center></h3>");
|
||||
writer.write("<b>Source File:</b> ");
|
||||
writer.write(fileName);
|
||||
writer.write("</font>");
|
||||
writer.write("<p><p>");
|
||||
|
||||
//
|
||||
// Create a table.
|
||||
@ -64,15 +61,13 @@ class HTMLResultRenderer
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.write("<font face=\"arial\">");
|
||||
writer.write("<table bgcolor=\"#FFFFD9\" border>");
|
||||
|
||||
//
|
||||
// Create the column headings.
|
||||
//
|
||||
writer.write("<tr>");
|
||||
writer.write("<th><b>Line No.</b></th>");
|
||||
writer.write("<th><b>Rule Name</b></th>");
|
||||
writer.write("<th><b>Line<br>No.</b></th>");
|
||||
writer.write("<th><b>Rule</b></th>");
|
||||
writer.write("<th><b>Description</b></th>");
|
||||
writer.write("<th><b>Example</b></th>");
|
||||
@ -91,17 +86,10 @@ class HTMLResultRenderer
|
||||
//
|
||||
// Line Number
|
||||
//
|
||||
writer.write("<td align=\"left\">");
|
||||
writer.write("<td align=\"center\" valign=\"top\">");
|
||||
writer.write(String.valueOf(ruleViolation.getLine()));
|
||||
writer.write("</td>");
|
||||
|
||||
//
|
||||
// Rule Name
|
||||
//
|
||||
writer.write("<td align=\"left\">");
|
||||
writer.write(rule.getName());
|
||||
writer.write("</td>");
|
||||
|
||||
//
|
||||
// Rule Message
|
||||
//
|
||||
@ -116,7 +104,7 @@ class HTMLResultRenderer
|
||||
ruleMessage = ruleMessage.replace('\n', ' ').trim();
|
||||
}
|
||||
|
||||
writer.write("<td align=\"left\">");
|
||||
writer.write("<td align=\"left\" valign=\"top\">");
|
||||
writer.write(ruleMessage);
|
||||
writer.write("</td>");
|
||||
|
||||
@ -134,7 +122,7 @@ class HTMLResultRenderer
|
||||
description = description.replace('\n', ' ').trim();
|
||||
}
|
||||
|
||||
writer.write("<td align=\"left\">");
|
||||
writer.write("<td align=\"left\" valign=\"top\">");
|
||||
writer.write(description);
|
||||
writer.write("</td>");
|
||||
|
||||
@ -145,7 +133,7 @@ class HTMLResultRenderer
|
||||
|
||||
if ((example != null) && (example.length() > 0))
|
||||
{
|
||||
writer.write("<td align=\"left\">");
|
||||
writer.write("<td align=\"left\" valign=\"top\">");
|
||||
writer.write("<pre>");
|
||||
writer.write(example);
|
||||
writer.write("</pre>");
|
||||
@ -159,7 +147,6 @@ class HTMLResultRenderer
|
||||
}
|
||||
|
||||
writer.write("</table>");
|
||||
writer.write("/font");
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1,6 +1,7 @@
|
||||
package net.sourceforge.pmd.swingui;
|
||||
|
||||
import java.awt.Color;
|
||||
import javax.swing.LookAndFeel;
|
||||
import javax.swing.UIDefaults;
|
||||
|
||||
import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;
|
||||
@ -14,9 +15,6 @@ import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;
|
||||
public class PMDLookAndFeel extends WindowsLookAndFeel
|
||||
{
|
||||
|
||||
public static final Color TABLE_BACKGROUND_COLOR = new Color(0xFFFFD9);
|
||||
public static final Color TREE_BACKGROUND_COLOR = new Color(0xFFFFD9);
|
||||
|
||||
/**************************************************************
|
||||
*
|
||||
* @return
|
||||
@ -110,5 +108,17 @@ public class PMDLookAndFeel extends WindowsLookAndFeel
|
||||
protected void initComponentDefaults(UIDefaults table)
|
||||
{
|
||||
super.initComponentDefaults(table);
|
||||
|
||||
Class wlafClass = WindowsLookAndFeel.class;
|
||||
Object[] defaults =
|
||||
{
|
||||
//J-
|
||||
"Tree.openIcon", LookAndFeel.makeIcon(wlafClass, "icons/TreeOpen.gif"),
|
||||
"Tree.closedIcon", LookAndFeel.makeIcon(wlafClass, "icons/TreeClosed.gif"),
|
||||
"Tree.leafIcon", LookAndFeel.makeIcon(wlafClass, "icons/TreeLeaf.gif"),
|
||||
//J
|
||||
};
|
||||
|
||||
table.putDefaults(defaults);
|
||||
}
|
||||
}
|
@ -38,10 +38,21 @@ public class PMDViewer extends JFrame
|
||||
|
||||
m_pmdViewer = this;
|
||||
|
||||
int windowWidth = 900;
|
||||
int windowHeight = 900;
|
||||
int windowMargin = 20;
|
||||
int windowWidth = 1000;
|
||||
int windowHeight = 1000;
|
||||
int windowMargin = 10;
|
||||
Dimension screenSize = getToolkit().getScreenSize();
|
||||
|
||||
if (windowWidth >= screenSize.width)
|
||||
{
|
||||
windowWidth = screenSize.width - 10;
|
||||
}
|
||||
|
||||
if (windowHeight >= screenSize.height)
|
||||
{
|
||||
windowHeight = screenSize.height - 20;
|
||||
}
|
||||
|
||||
int windowLocationX = (screenSize.width - windowWidth) / 2;
|
||||
int windowLocationY = (screenSize.height - windowHeight) / 2;
|
||||
|
||||
@ -72,7 +83,7 @@ public class PMDViewer extends JFrame
|
||||
JScrollPane directoryTreeScrollPane = new JScrollPane(m_directoryTree);
|
||||
|
||||
{
|
||||
Color background = PMDLookAndFeel.TREE_BACKGROUND_COLOR;
|
||||
Color background = UIManager.getColor("pmdTreeBackground");
|
||||
directoryTreeScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
directoryTreeScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
|
||||
directoryTreeScrollPane.getViewport().setBackground(background);
|
||||
@ -91,7 +102,7 @@ public class PMDViewer extends JFrame
|
||||
JScrollPane directoryTableScrollPane = new JScrollPane(directoryTable);
|
||||
|
||||
{
|
||||
Color background = PMDLookAndFeel.TABLE_BACKGROUND_COLOR;
|
||||
Color background = UIManager.getColor("pmdTableBackground");
|
||||
directoryTableScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
directoryTableScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
|
||||
directoryTableScrollPane.getViewport().setBackground(background);
|
||||
@ -142,7 +153,7 @@ public class PMDViewer extends JFrame
|
||||
|
||||
{
|
||||
mainSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
|
||||
mainSplitPane.setResizeWeight(0.5);
|
||||
mainSplitPane.setResizeWeight(0.2);
|
||||
mainSplitPane.setDividerSize(5);
|
||||
mainSplitPane.setTopComponent(directorySplitPane);
|
||||
mainSplitPane.setBottomComponent(resultsScrollPane);
|
||||
@ -154,7 +165,7 @@ public class PMDViewer extends JFrame
|
||||
JPanel contentPanel = new JPanel(new BorderLayout());
|
||||
|
||||
{
|
||||
Border outsideBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
|
||||
Border outsideBorder = BorderFactory.createEtchedBorder(EtchedBorder.RAISED);
|
||||
Border insideBorder = BorderFactory.createEmptyBorder(windowMargin,windowMargin,windowMargin,windowMargin);
|
||||
Border compoundBorder = BorderFactory.createCompoundBorder(outsideBorder, insideBorder);
|
||||
|
||||
@ -199,8 +210,8 @@ public class PMDViewer extends JFrame
|
||||
{
|
||||
// Setup the User Interface based on this computer's operating system.
|
||||
// This must be done before calling Java and Swing classes that call the GUI.
|
||||
String useLookAndFeel = UIManager.getSystemLookAndFeelClassName();
|
||||
//String useLookAndFeel = "net.sourceforge.pmd.swingui.PMDLookAndFeel";
|
||||
//String useLookAndFeel = UIManager.getSystemLookAndFeelClassName();
|
||||
String useLookAndFeel = "net.sourceforge.pmd.swingui.PMDLookAndFeel";
|
||||
|
||||
UIManager.setLookAndFeel(useLookAndFeel);
|
||||
|
||||
|
Reference in New Issue
Block a user