Class Legend


  • public class Legend
    extends java.lang.Object
    TODO: have a callback when color changes
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  Legend.LegendListener  
    • Constructor Summary

      Constructors 
      Constructor Description
      Legend()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static org.eclipse.swt.widgets.Composite createLegendComposite​(org.eclipse.swt.widgets.Composite panel, org.eclipse.swt.graphics.Color[] blockColors, java.lang.String[] keys)
      Create a legend containing a modifyable color box and description
      static org.eclipse.swt.widgets.Composite createLegendComposite​(org.eclipse.swt.widgets.Composite panel, org.eclipse.swt.graphics.Color[] blockColors, java.lang.String[] keys, boolean horizontal)  
      static org.eclipse.swt.widgets.Composite createLegendComposite​(org.eclipse.swt.widgets.Composite panel, org.eclipse.swt.graphics.Color[] blockColors, java.lang.String[] keys, java.lang.Object layoutData)  
      static org.eclipse.swt.widgets.Composite createLegendComposite​(org.eclipse.swt.widgets.Composite panel, org.eclipse.swt.graphics.Color[] blockColors, java.lang.String[] keys, java.lang.String[] key_texts, java.lang.Object layoutData, boolean horizontal)
      Create a legend containing a modifyable color box and description
      static org.eclipse.swt.widgets.Composite createLegendComposite​(org.eclipse.swt.widgets.Composite panel, org.eclipse.swt.graphics.Color[] blockColors, java.lang.String[] keys, java.lang.String[] key_texts, java.lang.Object layoutData, boolean horizontal, Legend.LegendListener listener)  
      static org.eclipse.swt.graphics.Color getLegendColor​(java.lang.String key, java.lang.String[] keys, org.eclipse.swt.graphics.Color[] defs)  
      private static org.eclipse.swt.graphics.Color getLegendColor​(java.lang.String key, org.eclipse.swt.graphics.Color def)  
      private static void handleHover​(Legend.LegendListener listener, boolean entry, int index, int[] state)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Legend

        public Legend()
    • Method Detail

      • createLegendComposite

        public static org.eclipse.swt.widgets.Composite createLegendComposite​(org.eclipse.swt.widgets.Composite panel,
                                                                              org.eclipse.swt.graphics.Color[] blockColors,
                                                                              java.lang.String[] keys)
        Create a legend containing a modifyable color box and description
        Parameters:
        panel - Where to add legend to
        blockColors - array of colors for each legend entry. This array WILL BE modified if the user changes the color
        keys - array of keys for each legend entry
        Returns:
        The composite containing the legend
      • createLegendComposite

        public static org.eclipse.swt.widgets.Composite createLegendComposite​(org.eclipse.swt.widgets.Composite panel,
                                                                              org.eclipse.swt.graphics.Color[] blockColors,
                                                                              java.lang.String[] keys,
                                                                              boolean horizontal)
      • createLegendComposite

        public static org.eclipse.swt.widgets.Composite createLegendComposite​(org.eclipse.swt.widgets.Composite panel,
                                                                              org.eclipse.swt.graphics.Color[] blockColors,
                                                                              java.lang.String[] keys,
                                                                              java.lang.Object layoutData)
      • createLegendComposite

        public static org.eclipse.swt.widgets.Composite createLegendComposite​(org.eclipse.swt.widgets.Composite panel,
                                                                              org.eclipse.swt.graphics.Color[] blockColors,
                                                                              java.lang.String[] keys,
                                                                              java.lang.String[] key_texts,
                                                                              java.lang.Object layoutData,
                                                                              boolean horizontal)
        Create a legend containing a modifyable color box and description
        Parameters:
        panel - Where to add legend to
        blockColors - array of colors for each legend entry. This array WILL BE modified if the user changes the color
        keys - array of keys for each legend entry
        layoutData - How to layout the legend (ie. GridData, LayoutData, etc)
        Returns:
        The composite containing the legend
      • getLegendColor

        public static org.eclipse.swt.graphics.Color getLegendColor​(java.lang.String key,
                                                                    java.lang.String[] keys,
                                                                    org.eclipse.swt.graphics.Color[] defs)
      • getLegendColor

        private static org.eclipse.swt.graphics.Color getLegendColor​(java.lang.String key,
                                                                     org.eclipse.swt.graphics.Color def)
      • createLegendComposite

        public static org.eclipse.swt.widgets.Composite createLegendComposite​(org.eclipse.swt.widgets.Composite panel,
                                                                              org.eclipse.swt.graphics.Color[] blockColors,
                                                                              java.lang.String[] keys,
                                                                              java.lang.String[] key_texts,
                                                                              java.lang.Object layoutData,
                                                                              boolean horizontal,
                                                                              Legend.LegendListener listener)
      • handleHover

        private static void handleHover​(Legend.LegendListener listener,
                                        boolean entry,
                                        int index,
                                        int[] state)