[Mc4j-cvs] mc4j/src/org/mc4j/console/dashboard Dashboard.java,1.13,1.14 DashboardComponentFactory.ja
Brought to you by:
ghinkl
From: Greg H. <gh...@us...> - 2004-04-08 20:43:55
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/dashboard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5745/src/org/mc4j/console/dashboard Modified Files: Dashboard.java DashboardComponentFactory.java DashboardFactory.java DashboardLoader.java Log Message: Allow for the name of dashboard to be context looked up base on context attributes. Added the object name properties as content entries. Index: DashboardFactory.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/dashboard/DashboardFactory.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** DashboardFactory.java 2 Apr 2004 03:34:05 -0000 1.10 --- DashboardFactory.java 8 Apr 2004 20:30:43 -0000 1.11 *************** *** 137,141 **** JPanel contentPanel = new JPanel(); context.put(Dashboard.CONTEXT_DASHBOARD_ROOT_CONTAINER, contentPanel); ! context.put(Dashboard.CONTEXT_DASHBOARD_NAME, dashboard.getName()); --- 137,141 ---- JPanel contentPanel = new JPanel(); context.put(Dashboard.CONTEXT_DASHBOARD_ROOT_CONTAINER, contentPanel); ! context.put(Dashboard.CONTEXT_DASHBOARD_NAME, dashboard.getDisplayName()); Index: Dashboard.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/dashboard/Dashboard.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Dashboard.java 7 Apr 2004 02:54:38 -0000 1.13 --- Dashboard.java 8 Apr 2004 20:30:43 -0000 1.14 *************** *** 50,53 **** --- 50,55 ---- private String name; + private String displayName; + private String description; *************** *** 71,74 **** --- 73,77 ---- this.name = name; + this.displayName = name; this.dashboardDocument = dashboardDocument; *************** *** 82,86 **** public int compareTo(Object o) { Dashboard d = (Dashboard) o; ! return getName().compareTo(d.getName()); } --- 85,89 ---- public int compareTo(Object o) { Dashboard d = (Dashboard) o; ! return getDisplayName().compareTo(d.getDisplayName()); } *************** *** 110,113 **** --- 113,124 ---- } + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + /** Getter for property description. * @return Value of property description. Index: DashboardComponentFactory.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/dashboard/DashboardComponentFactory.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** DashboardComponentFactory.java 2 Apr 2004 03:34:05 -0000 1.8 --- DashboardComponentFactory.java 8 Apr 2004 20:30:43 -0000 1.9 *************** *** 21,28 **** --- 21,32 ---- import java.awt.Color; + import java.awt.Graphics; + import java.awt.Graphics2D; + import java.awt.RenderingHints; import java.util.Map; import javax.swing.JComponent; import javax.swing.JEditorPane; + import javax.swing.JLabel; import javax.swing.JScrollPane; *************** *** 49,55 **** IOProvider.getDefault().getIO("Dashboard debugging",false).getOut().println("Instantiating new component: " + type); try { Class componentType = Class.forName(type); ! JComponent component = (JComponent) componentType.newInstance(); ! AttributeFactory.loadAttributes(node, component, context); --- 53,73 ---- IOProvider.getDefault().getIO("Dashboard debugging",false).getOut().println("Instantiating new component: " + type); try { + JComponent component = null; + Class componentType = Class.forName(type); ! if (componentType.equals(JLabel.class)){ ! // GH - This hack is to make dashboards look more attractive. ! component = new JLabel() { ! public void paintComponent(Graphics g) { ! Graphics2D g2 = (Graphics2D)g; ! g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, ! RenderingHints.VALUE_ANTIALIAS_ON); ! super.paintComponent(g); ! } ! }; ! ! } else { ! component = (JComponent) componentType.newInstance(); ! } AttributeFactory.loadAttributes(node, component, context); |