package art.servers.asfserver.types;
|
|
import art.servers.asfserver.protocols.dgt.AsfDgtConstants;
|
import java.awt.Color;
|
|
|
public class VmsLine
|
{
|
public int subpanel = 0;
|
public int line = 0;
|
public int foreground = AsfDgtConstants.ASF_BLACK;
|
public int background = AsfDgtConstants.ASF_BLACK;
|
public boolean blinking = false;
|
public String text = "";
|
|
|
public void setAttribute (int attribute)
|
{
|
if ((attribute & 0x40) != 0) blinking = true;
|
|
if (((attribute & 0x20) != 0) && ((attribute & 0x10) != 0) && ((attribute & 0x08) != 0)) foreground = AsfDgtConstants.ASF_WHITE;
|
if (((attribute & 0x20) == 0) && ((attribute & 0x10) != 0) && ((attribute & 0x08) != 0)) foreground = AsfDgtConstants.ASF_YELLOW;
|
|
if (((attribute & 0x20) != 0) && ((attribute & 0x10) != 0) && ((attribute & 0x08) == 0)) foreground = AsfDgtConstants.ASF_MAGENTA;
|
if (((attribute & 0x20) == 0) && ((attribute & 0x10) != 0) && ((attribute & 0x08) == 0)) foreground = AsfDgtConstants.ASF_RED;
|
|
if (((attribute & 0x20) != 0) && ((attribute & 0x10) == 0) && ((attribute & 0x08) != 0)) foreground = AsfDgtConstants.ASF_CYAN;
|
if (((attribute & 0x20) == 0) && ((attribute & 0x10) == 0) && ((attribute & 0x08) != 0)) foreground = AsfDgtConstants.ASF_GREEN;
|
|
if (((attribute & 0x20) != 0) && ((attribute & 0x10) == 0) && ((attribute & 0x08) == 0)) foreground = AsfDgtConstants.ASF_BLUE;
|
if (((attribute & 0x20) == 0) && ((attribute & 0x10) == 0) && ((attribute & 0x08) == 0)) foreground = AsfDgtConstants.ASF_BLACK;
|
|
|
if (((attribute & 0x04) != 0) && ((attribute & 0x02) != 0) && ((attribute & 0x01) != 0)) background = AsfDgtConstants.ASF_WHITE;
|
if (((attribute & 0x04) == 0) && ((attribute & 0x02) != 0) && ((attribute & 0x01) != 0)) background = AsfDgtConstants.ASF_YELLOW;
|
|
if (((attribute & 0x04) != 0) && ((attribute & 0x02) != 0) && ((attribute & 0x01) == 0)) background = AsfDgtConstants.ASF_MAGENTA;
|
if (((attribute & 0x04) == 0) && ((attribute & 0x02) != 0) && ((attribute & 0x01) == 0)) background = AsfDgtConstants.ASF_RED;
|
|
if (((attribute & 0x04) != 0) && ((attribute & 0x02) == 0) && ((attribute & 0x01) != 0)) background = AsfDgtConstants.ASF_CYAN;
|
if (((attribute & 0x04) == 0) && ((attribute & 0x02) == 0) && ((attribute & 0x01) != 0)) background = AsfDgtConstants.ASF_GREEN;
|
|
if (((attribute & 0x04) != 0) && ((attribute & 0x02) == 0) && ((attribute & 0x01) == 0)) background = AsfDgtConstants.ASF_BLUE;
|
if (((attribute & 0x04) == 0) && ((attribute & 0x02) == 0) && ((attribute & 0x01) == 0)) background = AsfDgtConstants.ASF_BLACK;
|
}
|
|
|
public int getForeground ()
|
{
|
switch (foreground)
|
{
|
case AsfDgtConstants.ASF_BLACK: return(Color.BLACK.getRGB());
|
case AsfDgtConstants.ASF_WHITE: return(Color.WHITE.getRGB());
|
case AsfDgtConstants.ASF_RED: return(Color.RED.getRGB());
|
case AsfDgtConstants.ASF_GREEN: return(Color.GREEN.getRGB());
|
case AsfDgtConstants.ASF_BLUE: return(Color.BLUE.getRGB());
|
case AsfDgtConstants.ASF_YELLOW: return(Color.YELLOW.getRGB());
|
case AsfDgtConstants.ASF_CYAN: return(Color.CYAN.getRGB());
|
case AsfDgtConstants.ASF_MAGENTA: return(Color.MAGENTA.getRGB());
|
}
|
|
return(Color.YELLOW.getRGB());
|
}
|
|
|
public int getBackground ()
|
{
|
switch (background)
|
{
|
case AsfDgtConstants.ASF_BLACK: return(Color.black.getRGB());
|
case AsfDgtConstants.ASF_WHITE: return(Color.white.getRGB());
|
case AsfDgtConstants.ASF_RED: return(Color.red.getRGB());
|
case AsfDgtConstants.ASF_GREEN: return(Color.green.getRGB());
|
case AsfDgtConstants.ASF_BLUE: return(Color.blue.getRGB());
|
case AsfDgtConstants.ASF_YELLOW: return(Color.yellow.getRGB());
|
case AsfDgtConstants.ASF_CYAN: return(Color.cyan.getRGB());
|
case AsfDgtConstants.ASF_MAGENTA: return(Color.magenta.getRGB());
|
}
|
|
return(Color.black.getRGB());
|
}
|
|
}
|