< prev index next >
src/com/sun/javatest/tool/UIFactory.java
Print this page
rev 145 : 7902237: Fixing raw use of parameterized class
Reviewed-by: jjg
*** 410,420 ****
* for i18n strings; the bundle is named i18n.properties
* in the same package as the specified class.
* @param c the class used to determine the i18n properties
* @param helpBroker the help broker to be used when creating help buttons
*/
! public UIFactory(Class c, HelpBroker helpBroker) {
this(c, null, helpBroker);
}
/**
* Create a UIFactory object for a specific component.
--- 410,420 ----
* for i18n strings; the bundle is named i18n.properties
* in the same package as the specified class.
* @param c the class used to determine the i18n properties
* @param helpBroker the help broker to be used when creating help buttons
*/
! public UIFactory(Class<?> c, HelpBroker helpBroker) {
this(c, null, helpBroker);
}
/**
* Create a UIFactory object for a specific component.
*** 435,445 ****
* in the same package as the specified class.
* @param c the class used to determine the i18n properties
* @param p the parent component to be used for any dialogs that are created
* @param helpBroker the help broker to be used when creating help buttons
*/
! public UIFactory(Class c, Component p, HelpBroker helpBroker) {
this.helpBroker = helpBroker;
clientClass = c;
parent = p;
i18n = I18NResourceBundle.getBundleForClass(c);
}
--- 435,445 ----
* in the same package as the specified class.
* @param c the class used to determine the i18n properties
* @param p the parent component to be used for any dialogs that are created
* @param helpBroker the help broker to be used when creating help buttons
*/
! public UIFactory(Class<?> c, Component p, HelpBroker helpBroker) {
this.helpBroker = helpBroker;
clientClass = c;
parent = p;
i18n = I18NResourceBundle.getBundleForClass(c);
}
*** 1159,1169 ****
* @param choiceKeys an array of strings used to construct the resource
* names for the choices.
* @return the choice item that was created
* @see #createLiteralChoice
*/
! public JComboBox createChoice(final String uiKey, final String[] choiceKeys) {
return createChoice(uiKey, choiceKeys, false);
}
/**
* Same as the two parameter <code>createChoice</code>, except you can
--- 1159,1169 ----
* @param choiceKeys an array of strings used to construct the resource
* names for the choices.
* @return the choice item that was created
* @see #createLiteralChoice
*/
! public JComboBox<String> createChoice(final String uiKey, final String[] choiceKeys) {
return createChoice(uiKey, choiceKeys, false);
}
/**
* Same as the two parameter <code>createChoice</code>, except you can
*** 1204,1214 ****
ed_ac.setAccessibleDescription(ac.getAccessibleDescription());
}
}
choice.setRenderer(new DefaultListCellRenderer() {
! public Component getListCellRendererComponent(JList list, Object o, int index,
boolean isSelected, boolean cellHasFocus) {
Object c = o;
for (int i = 0; i < choiceKeys.length; i++) {
if (choiceKeys[i] == o) {
c = choices[i];
--- 1204,1214 ----
ed_ac.setAccessibleDescription(ac.getAccessibleDescription());
}
}
choice.setRenderer(new DefaultListCellRenderer() {
! public Component getListCellRendererComponent(JList<?> list, Object o, int index,
boolean isSelected, boolean cellHasFocus) {
Object c = o;
for (int i = 0; i < choiceKeys.length; i++) {
if (choiceKeys[i] == o) {
c = choices[i];
*** 1230,1240 ****
* </table>
* In addition, the name of the choice is set to <i>uiKey</i>.
* @param uiKey the base name of the resources to be used for the menu
* @return the choice component that was created
*/
! public JComboBox createChoice(String uiKey) {
return createChoice(uiKey, false);
}
/**
* Same as single parameter version, except you can select a
--- 1230,1240 ----
* </table>
* In addition, the name of the choice is set to <i>uiKey</i>.
* @param uiKey the base name of the resources to be used for the menu
* @return the choice component that was created
*/
! public <E> JComboBox<E> createChoice(String uiKey) {
return createChoice(uiKey, false);
}
/**
* Same as single parameter version, except you can select a
*** 1243,1254 ****
* @param editable True if the user should be allowed to edit the
* response.
* @return the choice component that was created
* @see #createChoice(String)
*/
! public JComboBox createChoice(String uiKey, boolean editable) {
! return createChoice(uiKey, editable, (JLabel) null);
}
/**
* Same as the one parameter version, except a label can be
* associated with this component. This is to support accessibility.
--- 1243,1254 ----
* @param editable True if the user should be allowed to edit the
* response.
* @return the choice component that was created
* @see #createChoice(String)
*/
! public <E> JComboBox<E> createChoice(String uiKey, boolean editable) {
! return createChoice(uiKey, editable, null);
}
/**
* Same as the one parameter version, except a label can be
* associated with this component. This is to support accessibility.
*** 3550,3560 ****
}
}
}
};
! private Class clientClass;
private Component parent;
private I18NResourceBundle i18n;
private HelpBroker helpBroker;
private static I18NResourceBundle local_i18n = I18NResourceBundle.getBundleForClass(UIFactory.class);
--- 3550,3560 ----
}
}
}
};
! private Class<?> clientClass;
private Component parent;
private I18NResourceBundle i18n;
private HelpBroker helpBroker;
private static I18NResourceBundle local_i18n = I18NResourceBundle.getBundleForClass(UIFactory.class);
*** 3569,3581 ****
* This class might be helpful, when a component extends another components
* from a different package.
*/
public static class UIFactoryExt extends UIFactory {
private I18NResourceBundle i18n_alt;
! private Class altClass;
! public UIFactoryExt(UIFactory uif, Class altClass) {
super(uif.clientClass, uif.parent, uif.helpBroker);
i18n_alt = I18NResourceBundle.getBundleForClass(altClass);
this.altClass = altClass;
}
--- 3569,3581 ----
* This class might be helpful, when a component extends another components
* from a different package.
*/
public static class UIFactoryExt extends UIFactory {
private I18NResourceBundle i18n_alt;
! private Class<?> altClass;
! public UIFactoryExt(UIFactory uif, Class<?> altClass) {
super(uif.clientClass, uif.parent, uif.helpBroker);
i18n_alt = I18NResourceBundle.getBundleForClass(altClass);
this.altClass = altClass;
}
< prev index next >