org.knime.base.node.viz.aggregation.util
Class GUIUtils

java.lang.Object
  extended by org.knime.base.node.viz.aggregation.util.GUIUtils

public final class GUIUtils
extends Object

This class provides different methods which are used in multiple aggregation implementations mainly in the GUI creation.

Author:
Tobias Koetter, University of Konstanz

Field Summary
static String NO_ELEMENT_SELECTED_TEXT
          This message is displayed in the details tab if no element is selected.
 
Method Summary
static ButtonGroup createButtonGroup(ButtonGroupEnumInterface[] elements, ActionListener l)
           
static ButtonGroup createButtonGroup(ButtonGroupEnumInterface[] elements, ButtonGroupEnumInterface defaultButton, ActionListener l)
           
static Box createButtonGroupBox(ButtonGroup group, boolean vertical, String label, boolean border)
           
static String createHTMLDetailData(List<? extends AggregationValModel> valModels)
           
static String createHTMLDetailData(List<? extends AggregationValModel> valModels, double[] vals)
           
static String createHTMLTotalData(double[] vals)
           
static String createLabel(double aggrVal, int noOfDigits, AggregationMethod aggrMethod)
           
static String createLabel(double aggrVal, int noOfDigits, AggregationMethod aggrMethod, ValueScale scale)
           
static Color generateDistinctColor(int idx, int size)
          Generates most distinct colors for neighbor indexes.
static void setSliderLabels(JSlider slider, int divisor, boolean showDigitsAndTicks)
          Sets the label of the given slider.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_ELEMENT_SELECTED_TEXT

public static final String NO_ELEMENT_SELECTED_TEXT
This message is displayed in the details tab if no element is selected.

See Also:
Constant Field Values
Method Detail

createButtonGroup

public static ButtonGroup createButtonGroup(ButtonGroupEnumInterface[] elements,
                                            ActionListener l)
Parameters:
elements - the elements to create the button group for and selects the last element which returns true as isDefault()
l - the optional listener to add to each button of this group
Returns:
the button group

createButtonGroup

public static ButtonGroup createButtonGroup(ButtonGroupEnumInterface[] elements,
                                            ButtonGroupEnumInterface defaultButton,
                                            ActionListener l)
Parameters:
elements - the elements to create the button group for and selects the last element which returns true as isDefault()
defaultButton - the default group element to select or null if the enumeration default element should be selected
l - the optional listener to add to each button of this group
Returns:
the button group

createButtonGroupBox

public static Box createButtonGroupBox(ButtonGroup group,
                                       boolean vertical,
                                       String label,
                                       boolean border)
Parameters:
group - the button group to put in a swing box
vertical - if the group should be layout vertical
label - the label of the swing box
border - true if the label should be displayed in a surrounding border
Returns:
a swing box with the buttons of the given group

createLabel

public static String createLabel(double aggrVal,
                                 int noOfDigits,
                                 AggregationMethod aggrMethod)
Parameters:
aggrVal - the value to use as label
noOfDigits - the number of digits if it's a floating point number
aggrMethod - the AggregationMethod
Returns:
the rounded aggregation value as String label

createLabel

public static String createLabel(double aggrVal,
                                 int noOfDigits,
                                 AggregationMethod aggrMethod,
                                 ValueScale scale)
Parameters:
aggrVal - the value to use as label
noOfDigits - the number of digits if it's a floating point number
aggrMethod - the AggregationMethod
scale - the ValueScale
Returns:
the rounded aggregation value as String label

createHTMLDetailData

public static String createHTMLDetailData(List<? extends AggregationValModel> valModels)
Parameters:
valModels - the values to create the details information for
Returns:
the html detail representation of the given values

createHTMLDetailData

public static String createHTMLDetailData(List<? extends AggregationValModel> valModels,
                                          double[] vals)
Parameters:
valModels - the values to create the details information for
vals - the value array to add the current count, value count and sum to
Returns:
the html detail representation of the given values

createHTMLTotalData

public static String createHTMLTotalData(double[] vals)
Parameters:
vals - the array contains the total count, value count and sum in this order
Returns:
the html code with the total value information

generateDistinctColor

public static Color generateDistinctColor(int idx,
                                          int size)
Generates most distinct colors for neighbor indexes.

Parameters:
idx - the current index
size - the total number of colors to generate
Returns:
the color for the current index

setSliderLabels

public static void setSliderLabels(JSlider slider,
                                   int divisor,
                                   boolean showDigitsAndTicks)
Sets the label of the given slider.

Parameters:
slider - the slider to label
divisor - the steps are calculated maxVal - minVal / divisor
showDigitsAndTicks - true if the ticks and their labels should be displayed


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.