Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## info.bioinfweb.treegraph.document
Class ContrastManager

    java.lang.Object
      info.bioinfweb.treegraph.document.ContrastManager

    public class ContrastManager

extends Object

Ensures that document elements (that are e.g. pasted from the clipboard) have a sufficient contrast to the document background.

Since:
  2.0.20-140
Author:
  Ben Stöver

Nested Class Summary
`(package private) static class` | `ContrastManager.State`

Field Summary
`private ContrastManager.State` | `state`

Constructor Summary
`ContrastManager()`

Method Summary
`private boolean` | `checkColor(Color foreground, Color background)` Checks if two colors have an unsifficient contast.
`private boolean` | `confirmChange()` Asks the user whether to change any colors if this was not already done.
`boolean` | `ensureContrast(Document document, Legend legend)` Checks the text color of the specified legend regarding to its contrast to the background color of the document.
`boolean` | `ensureContrast(Document document, Node root)` Checks the colors of all elements in the subtree under `root` (including `root` and its afferent branch) regarding to their contrast to the background color of the document.
`boolean` | `ensureContrast(Document document, TextLabel label)` Checks the text color of the specified label regarding to its contrast to the background color of the document.
`boolean` | `ensureContrast(Document document, TextLabel[] labels)` Checks the text color of the specified labels regarding to their contrast to the background color of the document.
`private boolean` | `ensureLabelBlock(Labels labels, boolean above, Color bgColor, Color defaultColor)`
`private boolean` | `ensureLabelContrast(Document document, TextLabel label)` Internal method which does not set `state = State.UNDEFINED`.
`private boolean` | `ensureSubtreeContrast(Document document, Node root)` Rekursive method which contains the actual implementation.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### state

    private ContrastManager.State state

Constructor Detail

### ContrastManager

    public ContrastManager()

Method Detail

### confirmChange

    private boolean confirmChange()

  Asks the user whether to change any colors if this was not already done.

  Returns:
    `false` if the user aborted the operation during the call of this method

### checkColor

    private boolean checkColor(Color foreground,
                               Color background)

  Checks if two colors have an unsifficient contast.

  Parameters:
    `foreground` -
    `background` -
  Returns:
    `false` if the user aborted the operation during the call of this method

### ensureLabelBlock

    private boolean ensureLabelBlock(Labels labels,
                                     boolean above,
                                     Color bgColor,
                                     Color defaultColor)

### ensureSubtreeContrast

    private boolean ensureSubtreeContrast(Document document,
                                          Node root)

  Rekursive method which contains the actual implementation.

  Parameters:
    `document` - - the document where the subtree shall be inserted to
    `root` - - the root node of the subtree
  Returns:
    `false` if the user aborted the operation during the call of this method

### ensureContrast

    public boolean ensureContrast(Document document,
                                  Node root)

  Checks the colors of all elements in the subtree under `root` (including `root` and its afferent branch) regarding to their contrast to the background color of the document.

  Parameters:
    `document` - - the document where the subtree shall be inserted to
    `root` - - the root node of the subtree
    `defaultColor` - - the color which shall be set to elements with an unsufficient contrast
  Returns:
    `false` if the subtree shall not be pasted

### ensureLabelContrast

    private boolean ensureLabelContrast(Document document,
                                        TextLabel label)

  Internal method which does not set `state = State.UNDEFINED`.

  Parameters:
    `document` - - the document where the label shall be inserted to
    `label` -
  Returns:
    `false` if the user aborted the operation during the call of this method

### ensureContrast

    public boolean ensureContrast(Document document,
                                  TextLabel label)

  Checks the text color of the specified label regarding to its contrast to the background color of the document.

  Parameters:
    `document` - - the document where the subtree shall be inserted to
    `label` - - the label to be inserted
    `defaultColor` - - the color which shall be set to elements with an unsufficient contrast
  Returns:
    `false` if the label shall not be pasted

### ensureContrast

    public boolean ensureContrast(Document document,
                                  TextLabel[] labels)

  Checks the text color of the specified labels regarding to their contrast to the background color of the document.

  Parameters:
    `document` - - the document where the subtree shall be inserted to
    `labels` - - the labels to be inserted
  Returns:
    `false` if the labels shall not be pasted

### ensureContrast

    public boolean ensureContrast(Document document,
                                  Legend legend)

  Checks the text color of the specified legend regarding to its contrast to the background color of the document.

  Parameters:
    `document` - - the document where the subtree shall be inserted to
    `legend` - - the legend to be inserted
  Returns:
    `false` if the legend shall not be pasted

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD