[rfc][icedtea-web] itweb-settings Control Panel Resizing

Jacob Wisor gitne at gmx.de
Sat Jul 5 11:42:44 UTC 2014


On 07/04/2014 08:18 PM, Jie Kang wrote:
> Hello,
>
> I have created a patch fixing the issues outlined here: http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=1856
>
> The UI behaves better for lower resolutions (e.g. 800x600).
>

Thank you for fixing this. Would you like to backport this to 1.5 too, since 
panel resizing has been broken since then (presumably by Jiri ;-) )?

Thank you also for formatting the source code.

 > +    ListCellRenderer comboRendererWithToolTips = new
 > DefaultListCellRenderer() {
 > +
 > +        @Override
 > +        public Component getListCellRendererComponent(JList<?> list,
 > +                Object value, int index, boolean isSelected,
 > +                boolean cellHasFocus) {

Please make getListCellRendererComponent()'s parameters final. The method itself 
can be made final too.

 > +            setToolTipText(value.toString());

Since getListCellRendererComponent() has a public access modifier, value can be 
null. For the sake of robustness please add the trinary operator here to check 
value for null before dereferencing it.

 > +            return super.getListCellRendererComponent(list, value, index,
 > isSelected,
 > +                    cellHasFocus);
 > +        }
 > +
 > +    };
 > +
 > [...]
 > @@ -338,15 +361,15 @@
 >
 >          globalBehaviourLabel.setText(
 >     Translator.R("APPEXTSECguiPanelGlobalBehaviourCaption"));
 >
 > -        deleteTypeComboBox.setModel(new
 > javax.swing.DefaultComboBoxModel<>(new String[] {

Please beware of the "diamond" operator when backporting to 1.5. ;-)

 > +        deleteTypeComboBox.setModel(new DefaultComboBoxModel<>(new String[] {
 >                      Translator.R("APPEXTSECguiPanelDeleteMenuSelected"),
 >                      Translator.R("APPEXTSECguiPanelDeleteMenuAllA"),
 >                      Translator.R("APPEXTSECguiPanelDeleteMenuAllN"),
 >                      Translator.R("APPEXTSECguiPanelDeleteMenuAlly"),
 >                      Translator.R("APPEXTSECguiPanelDeleteMenuAlln"),
 >                      Translator.R("APPEXTSECguiPanelDeleteMenuAllAll")}));
 > -
 > -        viewFilter.setModel(new javax.swing.DefaultComboBoxModel<>(new
 > String[] {
 > +        deleteTypeComboBox.setRenderer(comboRendererWithToolTips);
 > +        viewFilter.setModel(new DefaultComboBoxModel<>(new String[] {

Please beware of the "diamond" operator when backporting to 1.5. ;-)

 >                      Translator.R("APPEXTSECguiPanelShowOnlyPermanent"),
 >                      Translator.R("APPEXTSECguiPanelShowOnlyTemporal"),
 >                      Translator.R("APPEXTSECguiPanelShowAll"),
 > [...]
 > @@ -756,12 +779,12 @@
 >      }
 >
 >      private void reloadTable() {
 > -        List<? extends SortKey> l =
 > currentTable.getRowSorter().getSortKeys();
 > +        List<? extends javax.swing.RowSorter.SortKey> l =
 > currentTable.getRowSorter().getSortKeys();

Why did you remove the import for SortKey?

 >          currentTable.setModel(new DefaultTableModel());
 >          currentTable.setModel(currentModel);
 >          {
 >              currentTable.getRowSorter().setSortKeys(l);
 > -
 > +
 >          }
 >
 >      }

Apart from that, good work! :-)

Jacob


More information about the distro-pkg-dev mailing list