[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] FYI: getPropertyPrefix() in UI delegates
From: |
David Gilbert |
Subject: |
[cp-patches] FYI: getPropertyPrefix() in UI delegates |
Date: |
Wed, 31 Aug 2005 16:30:00 +0000 |
User-agent: |
Mozilla Thunderbird 1.0.6 (X11/20050728) |
I committed this patch to tidy up the getPropertyPrefix() methods in the UI
delegates for the Basic look and feel. Sun's implementation is a little
inconsistent here: all the descendants of BasicButtonUI include the full stop ('.')
with the prefix, while the descendants of BasicMenuItemUI and BasicTextUI don't. I
thought it best to match that inconsistency, since custom look and feels that extend
BasicLookAndFeel will likely rely on it. I have Mauve tests that check the values,
and all pass with this patch. I didn't notice any differences with the Swing demo
before and after this change:
2005-08-31 David Gilbert <address@hidden>
* javax/swing/plaf/basic/BasicButtonUI.java
(getPropertyPrefix): include dot in prefix,
(installDefaults): remove dot which is included in prefix now,
* javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java
(getPropertyPrefix): return correct prefix,
* javax/swing/plaf/basic/BasicCheckBoxUI.java
(getPropertyPrefix): return correct prefix,
* javax/swing/plaf/basic/BasicMenuItemUI.java
(getPropertyPrefix): return correct prefix,
* javax/swing/plaf/basic/BasicMenuUI.java
(getPropertyPrefix): return correct prefix,
* javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java
(getPropertyPrefix): return correct prefix,
* javax/swing/plaf/basic/BasicRadioButtonUI.java
(getPropertyPrefix): include dot in prefix,
(getDefaultIcon): removed dot which is part of the prefix,
* javax/swing/plaf/basic/BasicToggleButtonUI.java
(getPropertyPrefix): include dot in prefix,
* javax/swing/plaf/metal/MetalCheckBoxUI.java: now extends
MetalRadioButtonUI,
(getPropertyPrefix): implemented.
Regards,
Dave
Index: javax/swing/plaf/basic/BasicButtonUI.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicButtonUI.java,v
retrieving revision 1.23
diff -u -r1.23 BasicButtonUI.java
--- javax/swing/plaf/basic/BasicButtonUI.java 26 Jul 2005 14:44:07 -0000
1.23
+++ javax/swing/plaf/basic/BasicButtonUI.java 31 Aug 2005 15:08:10 -0000
@@ -115,21 +115,21 @@
*/
protected String getPropertyPrefix()
{
- return "Button";
+ return "Button.";
}
protected void installDefaults(AbstractButton b)
{
UIDefaults defaults = UIManager.getLookAndFeelDefaults();
String prefix = getPropertyPrefix();
- focusColor = defaults.getColor(prefix + ".focus");
- b.setForeground(defaults.getColor(prefix + ".foreground"));
- b.setBackground(defaults.getColor(prefix + ".background"));
- b.setMargin(defaults.getInsets(prefix + ".margin"));
- b.setBorder(defaults.getBorder(prefix + ".border"));
- b.setIconTextGap(defaults.getInt(prefix + ".textIconGap"));
+ focusColor = defaults.getColor(prefix + "focus");
+ b.setForeground(defaults.getColor(prefix + "foreground"));
+ b.setBackground(defaults.getColor(prefix + "background"));
+ b.setMargin(defaults.getInsets(prefix + "margin"));
+ b.setBorder(defaults.getBorder(prefix + "border"));
+ b.setIconTextGap(defaults.getInt(prefix + "textIconGap"));
b.setInputMap(JComponent.WHEN_FOCUSED,
- (InputMap) defaults.get(prefix + ".focusInputMap"));
+ (InputMap) defaults.get(prefix + "focusInputMap"));
b.setOpaque(true);
}
Index: javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java,v
retrieving revision 1.8
diff -u -r1.8 BasicCheckBoxMenuItemUI.java
--- javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java 2 Jul 2005 20:32:50
-0000 1.8
+++ javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java 31 Aug 2005 15:08:11
-0000
@@ -67,13 +67,13 @@
}
/**
- * DOCUMENT ME!
+ * Returns the prefix for entries in the address@hidden UIDefaults} table.
*
- * @return $returnType$ DOCUMENT ME!
+ * @return "CheckBoxMenuItem"
*/
protected String getPropertyPrefix()
{
- return null;
+ return "CheckBoxMenuItem";
}
/**
Index: javax/swing/plaf/basic/BasicCheckBoxUI.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicCheckBoxUI.java,v
retrieving revision 1.10
diff -u -r1.10 BasicCheckBoxUI.java
--- javax/swing/plaf/basic/BasicCheckBoxUI.java 26 Aug 2005 18:17:57 -0000
1.10
+++ javax/swing/plaf/basic/BasicCheckBoxUI.java 31 Aug 2005 15:08:11 -0000
@@ -38,7 +38,6 @@
package javax.swing.plaf.basic;
-import javax.swing.AbstractButton;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.UIDefaults;
@@ -58,10 +57,14 @@
return defaults.getIcon("CheckBox.icon");
}
- // Overridden to change method access.
+ /**
+ * Returns the prefix for entries in the address@hidden UIDefaults} table.
+ *
+ * @return "CheckBox."
+ */
public String getPropertyPrefix()
{
- return super.getPropertyPrefix();
+ return "CheckBox.";
}
}
Index: javax/swing/plaf/basic/BasicMenuItemUI.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java,v
retrieving revision 1.20
diff -u -r1.20 BasicMenuItemUI.java
--- javax/swing/plaf/basic/BasicMenuItemUI.java 26 Aug 2005 18:17:57 -0000
1.20
+++ javax/swing/plaf/basic/BasicMenuItemUI.java 31 Aug 2005 15:08:12 -0000
@@ -359,9 +359,14 @@
defaultTextIconGap);
}
+ /**
+ * Returns the prefix for entries in the address@hidden UIDefaults} table.
+ *
+ * @return "MenuItem"
+ */
protected String getPropertyPrefix()
{
- return null;
+ return "MenuItem";
}
/**
Index: javax/swing/plaf/basic/BasicMenuUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicMenuUI.java,v
retrieving revision 1.14
diff -u -r1.14 BasicMenuUI.java
--- javax/swing/plaf/basic/BasicMenuUI.java 29 Jul 2005 19:05:01 -0000
1.14
+++ javax/swing/plaf/basic/BasicMenuUI.java 31 Aug 2005 15:08:13 -0000
@@ -189,9 +189,14 @@
return c.getPreferredSize();
}
+ /**
+ * Returns the prefix for entries in the address@hidden UIDefaults} table.
+ *
+ * @return "Menu"
+ */
protected String getPropertyPrefix()
{
- return null;
+ return "Menu";
}
/**
Index: javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java,v
retrieving revision 1.8
diff -u -r1.8 BasicRadioButtonMenuItemUI.java
--- javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java 2 Jul 2005
20:32:50 -0000 1.8
+++ javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java 31 Aug 2005
15:08:13 -0000
@@ -77,13 +77,13 @@
}
/**
- * DOCUMENT ME!
+ * Returns the prefix for entries in the address@hidden UIDefaults} table.
*
- * @return $returnType$ DOCUMENT ME!
+ * @return "RadioButtonMenuItem"
*/
protected String getPropertyPrefix()
{
- return null;
+ return "RadioButtonMenuItem";
}
/**
Index: javax/swing/plaf/basic/BasicRadioButtonUI.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicRadioButtonUI.java,v
retrieving revision 1.9
diff -u -r1.9 BasicRadioButtonUI.java
--- javax/swing/plaf/basic/BasicRadioButtonUI.java 22 Jul 2005 08:36:52
-0000 1.9
+++ javax/swing/plaf/basic/BasicRadioButtonUI.java 31 Aug 2005 15:08:13
-0000
@@ -103,7 +103,7 @@
*/
protected String getPropertyPrefix()
{
- return "RadioButton";
+ return "RadioButton.";
}
/**
@@ -117,7 +117,7 @@
public Icon getDefaultIcon()
{
UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- return defaults.getIcon(getPropertyPrefix() + ".icon");
+ return defaults.getIcon(getPropertyPrefix() + "icon");
}
/**
Index: javax/swing/plaf/basic/BasicToggleButtonUI.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicToggleButtonUI.java,v
retrieving revision 1.10
diff -u -r1.10 BasicToggleButtonUI.java
--- javax/swing/plaf/basic/BasicToggleButtonUI.java 2 Jul 2005 20:32:50
-0000 1.10
+++ javax/swing/plaf/basic/BasicToggleButtonUI.java 31 Aug 2005 15:08:13
-0000
@@ -56,7 +56,7 @@
*/
protected String getPropertyPrefix()
{
- return "ToggleButton";
+ return "ToggleButton.";
}
}
Index: javax/swing/plaf/metal/MetalCheckBoxUI.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/javax/swing/plaf/metal/MetalCheckBoxUI.java,v
retrieving revision 1.3
diff -u -r1.3 MetalCheckBoxUI.java
--- javax/swing/plaf/metal/MetalCheckBoxUI.java 2 Jul 2005 20:32:50 -0000
1.3
+++ javax/swing/plaf/metal/MetalCheckBoxUI.java 31 Aug 2005 15:08:13 -0000
@@ -38,12 +38,17 @@
package javax.swing.plaf.metal;
+import javax.swing.JCheckBox;
import javax.swing.JComponent;
+import javax.swing.UIDefaults;
import javax.swing.plaf.ComponentUI;
-import javax.swing.plaf.basic.BasicCheckBoxUI;
+/**
+ * A UI delegate for the address@hidden JCheckBox} component under the
+ * address@hidden MetalLookAndFeel}.
+ */
public class MetalCheckBoxUI
- extends BasicCheckBoxUI
+ extends MetalRadioButtonUI
{
// FIXME: maybe replace by a Map of instances when this becomes stateful
@@ -71,4 +76,15 @@
instance = new MetalCheckBoxUI();
return instance;
}
+
+ /**
+ * Returns the prefix for properties defined in the address@hidden
UIDefaults} table.
+ *
+ * @return The property prefix (<code>"CheckBox."</code>).
+ */
+ public String getPropertyPrefix()
+ {
+ return "CheckBox.";
+ }
}
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [cp-patches] FYI: getPropertyPrefix() in UI delegates,
David Gilbert <=