Class ColorAtom

  • All Implemented Interfaces:
    java.lang.Cloneable, Row

    public class ColorAtom
    extends Atom
    implements Row
    An atom representing the foreground and background color of an other atom.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.Map<java.lang.String,​java.awt.Color> Colors  
    • Constructor Summary

      Constructors 
      Constructor Description
      ColorAtom​(java.awt.Color bg, java.awt.Color c, ColorAtom old)
      Creates a ColorAtom that overrides the colors of the given ColorAtom if the given colors are not null.
      ColorAtom​(Atom atom, java.awt.Color bg, java.awt.Color c)
      Creates a new ColorAtom that sets the given colors for the given atom.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Box createBox​(TeXEnvironment env)
      Convert this atom into a Box, using properties set by "parent" atoms, like the TeX style, the last used font, color settings, ...
      static java.awt.Color getColor​(java.lang.String s)  
      int getLeftType()
      Get the type of the leftermost child atom.
      int getRightType()
      Get the type of the rightermost child atom.
      void setPreviousAtom​(Dummy prev)
      Sets the given dummy containing the atom that comes just before the first child atom of this "composed atom".
      • Methods inherited from class org.scilab.forge.jlatexmath.Atom

        clone
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • Colors

        public static java.util.Map<java.lang.String,​java.awt.Color> Colors
    • Constructor Detail

      • ColorAtom

        public ColorAtom​(Atom atom,
                         java.awt.Color bg,
                         java.awt.Color c)
        Creates a new ColorAtom that sets the given colors for the given atom. Null for a color means: no specific color set for this atom.
        Parameters:
        atom - the atom for which the given colors have to be set
        bg - the background color
        c - the foreground color
      • ColorAtom

        public ColorAtom​(java.awt.Color bg,
                         java.awt.Color c,
                         ColorAtom old)
        Creates a ColorAtom that overrides the colors of the given ColorAtom if the given colors are not null. If they're null, the old values are used.
        Parameters:
        bg - the background color
        c - the foreground color
        old - the ColorAtom for which the colorsettings should be overriden with the given colors.
    • Method Detail

      • createBox

        public Box createBox​(TeXEnvironment env)
        Description copied from class: Atom
        Convert this atom into a Box, using properties set by "parent" atoms, like the TeX style, the last used font, color settings, ...
        Specified by:
        createBox in class Atom
        Parameters:
        env - the current environment settings
        Returns:
        the resulting box.
      • getLeftType

        public int getLeftType()
        Description copied from class: Atom
        Get the type of the leftermost child atom. Most atoms have no child atoms, so the "left type" and the "right type" are the same: the atom's type. This also is the default implementation. But Some atoms are composed of child atoms put one after another in a horizontal row. These atoms must override this method.
        Overrides:
        getLeftType in class Atom
        Returns:
        the type of the leftermost child atom
      • getRightType

        public int getRightType()
        Description copied from class: Atom
        Get the type of the rightermost child atom. Most atoms have no child atoms, so the "left type" and the "right type" are the same: the atom's type. This also is the default implementation. But Some atoms are composed of child atoms put one after another in a horizontal row. These atoms must override this method.
        Overrides:
        getRightType in class Atom
        Returns:
        the type of the rightermost child atom
      • setPreviousAtom

        public void setPreviousAtom​(Dummy prev)
        Description copied from interface: Row
        Sets the given dummy containing the atom that comes just before the first child atom of this "composed atom". This method will allways be called by another composed atom, so this composed atom will be a child of it (nested). This is necessary to determine the glue to insert between the first child atom of this nested composed atom and the atom that the dummy contains.
        Specified by:
        setPreviousAtom in interface Row
        Parameters:
        prev - the dummy that comes just before this "composed atom"
      • getColor

        public static java.awt.Color getColor​(java.lang.String s)