Changeset 349


Ignore:
Timestamp:
Apr 6, 2012, 12:58:57 PM (5 years ago)
Author:
tim.te.beek@…
Message:

Add a better name renderer for Chart types

Location:
trunk/expression-data-viewer/src/main/java/nl/nbic/brs/expview
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/expression-data-viewer/src/main/java/nl/nbic/brs/expview/model/ChartTypes.java

    r347 r349  
    11package nl.nbic.brs.expview.model;
    22
     3import lombok.Getter;
     4
    35public enum ChartTypes {
    4         AREA, AREA_STACKED, //
    5         BAR, BAR_3D, BAR_STACKED, BAR_STACKED_3D, //
    6         LINE, LINE3D, //
    7         MULTIPLE_PIE, MULTIPLE_PIE_3D, //
    8         WATERFALL
     6        AREA("Area chart"), AREA_STACKED("Stacked Area chart"), //
     7        BAR("Bar chart"), BAR_3D("Bar chart 3D"), BAR_STACKED("Stacked Bar chart"), BAR_STACKED_3D("Stacked Bar chart 3D"), //
     8        LINE("Line chart"), LINE3D("Line chart 3D"), //
     9        MULTIPLE_PIE("Multiple Pie charts"), MULTIPLE_PIE_3D("Multiple Pie charts 3D"), //
     10        WATERFALL("Waterfall chart");
     11
     12        @Getter
     13        private final String    betterName;
     14
     15        private ChartTypes(final String betterName) {
     16                this.betterName = betterName;
     17        }
    918}
  • trunk/expression-data-viewer/src/main/java/nl/nbic/brs/expview/view/PlotDialog.java

    r348 r349  
    6565
    6666        private void initComponents() {
     67                // TODO Add labels & tooltips to UI controls
     68
    6769                String title = "title";
    6870                String categoryAxisLabel = "attributes";
     
    106108                // Type of chart selection
    107109                chartTypeComboBox = new JComboBox(plottingParams.getChartTypeModel());
    108                 // TODO Add a better renderer
     110                chartTypeComboBox.setRenderer(new DefaultListCellRenderer() {
     111                        @Override
     112                        public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) {
     113                                String name = ((ChartTypes) value).getBetterName();
     114                                return super.getListCellRendererComponent(list, name, index, isSelected, cellHasFocus);
     115                        }
     116                });
    109117        }
    110118
Note: See TracChangeset for help on using the changeset viewer.