ucot.ui.gui
Class DotColorTheme

java.lang.Object
  extended by ucot.ui.gui.DotColorTheme

public class DotColorTheme
extends java.lang.Object

This class implements a color theme for dot markup language, which is useful for DotPanel when figuring out color strings. It is easy to change the color theme using the method 'changeToColorTheme' and giving it the identifier of the preferred color theme. All themes available currently have to be hard coded here because of the way how dot understands colors. TODO Make color themes more dynamic? TODO Add more color themes.

Author:
tujupien

Nested Class Summary
private static interface DotColorTheme.CallBack
           
 
Field Summary
private  java.lang.String backgroundColor
           
static int BLACK_ON_WHITE_WITH_BLUE_HIGHLIGHTS
           
static int BLACK_ON_WHITE_WITH_GREEN_HIGHLIGHTS
           
private static int DEFAULT_COLOR_THEME
           
private  DotColorTheme.CallBack defaultColorTheme
           
private  java.lang.String highlightEdgeColor
           
private  java.lang.String highlightFillColor
           
private  java.lang.String highlightFontColor
           
private  java.lang.String normalEdgeColor
           
private  java.lang.String normalFillColor
           
private  java.lang.String normalFontColor
           
 
Constructor Summary
DotColorTheme()
          Default constructor for DotColorTheme class which initially uses the default color theme.
DotColorTheme(int theme)
          Constructor for DotColorTheme class.
 
Method Summary
private  void changeToBlackOnWhiteWithBlueHighlights()
          Change color theme to black text on white background with blue highlight colors.
private  void changeToBlackOnWhiteWithGreenHighlights()
          Change color theme to black text on white background with green highlight colors.
 void changeToColorTheme(int newTheme)
          Method for changing the color theme.
 java.awt.Color getBackgroundColorAsJavaObject()
          Method for getting the background color of the graph as a java object.
 java.lang.String getBackgroundColorString()
          Method for getting the background color of the whole graph in dot's syntax.
 java.lang.String getColorString(boolean isHighlighted)
          Method for getting the appropriate color string for an entity based on its highlight status.
 java.lang.String getHighlightedColorString()
          Method which formats highlighted item's color attributes into dot's syntax.
 java.lang.String getNormalColorString()
          Method which formats normal item's color attributes into dot's syntax.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

highlightFillColor

private java.lang.String highlightFillColor

highlightFontColor

private java.lang.String highlightFontColor

highlightEdgeColor

private java.lang.String highlightEdgeColor

normalFillColor

private java.lang.String normalFillColor

normalFontColor

private java.lang.String normalFontColor

normalEdgeColor

private java.lang.String normalEdgeColor

backgroundColor

private java.lang.String backgroundColor

BLACK_ON_WHITE_WITH_BLUE_HIGHLIGHTS

public static final int BLACK_ON_WHITE_WITH_BLUE_HIGHLIGHTS
See Also:
Constant Field Values

BLACK_ON_WHITE_WITH_GREEN_HIGHLIGHTS

public static final int BLACK_ON_WHITE_WITH_GREEN_HIGHLIGHTS
See Also:
Constant Field Values

DEFAULT_COLOR_THEME

private static final int DEFAULT_COLOR_THEME
See Also:
Constant Field Values

defaultColorTheme

private final DotColorTheme.CallBack defaultColorTheme
Constructor Detail

DotColorTheme

public DotColorTheme(int theme)
Constructor for DotColorTheme class.

Parameters:
theme - Initial color theme identifier.

DotColorTheme

public DotColorTheme()
Default constructor for DotColorTheme class which initially uses the default color theme.

Method Detail

changeToBlackOnWhiteWithBlueHighlights

private void changeToBlackOnWhiteWithBlueHighlights()
Change color theme to black text on white background with blue highlight colors.


changeToBlackOnWhiteWithGreenHighlights

private void changeToBlackOnWhiteWithGreenHighlights()
Change color theme to black text on white background with green highlight colors.


changeToColorTheme

public void changeToColorTheme(int newTheme)
Method for changing the color theme. Default theme is used if the given theme identifier is invalid.

Parameters:
newTheme - Identifier of the new theme.

getHighlightedColorString

public java.lang.String getHighlightedColorString()
Method which formats highlighted item's color attributes into dot's syntax.

Returns:
Highlight nodes' or edges' string in dot's syntax.

getBackgroundColorString

public java.lang.String getBackgroundColorString()
Method for getting the background color of the whole graph in dot's syntax.

Returns:
Background color string in dot's syntax.

getNormalColorString

public java.lang.String getNormalColorString()
Method which formats normal item's color attributes into dot's syntax.

Returns:
Normal nodes' or edges' string in dot's syntax.

getColorString

public java.lang.String getColorString(boolean isHighlighted)
Method for getting the appropriate color string for an entity based on its highlight status.

Parameters:
isHighlighted - Defines wether or not the returned color string is supposed to be for an highlighted entity or a normal entity.
Returns:
Returns appropriate color string in dot's syntax.

getBackgroundColorAsJavaObject

public java.awt.Color getBackgroundColorAsJavaObject()
Method for getting the background color of the graph as a java object. This helps to figure out the background color of the DotPanel.

Returns:
Graph background color as a Java object.