public class ColorTable extends BaseSysTable
ColorTableResource
interface). In addition, this implements:
RGB-VALUE
statement, via the rgbValue(int, int, int)
APISYSTEM-DIALOG COLOR
statement, via the
createColorChooserDialog(com.goldencode.p2j.util.int64)
APIPUT-KEY-VALUE COLOR ALL
statement, via the saveColorTable()
API PUT-KEY-VALUE COLOR color-num
statement, via the saveColor(long)
API
Modifier and Type | Class and Description |
---|---|
static class |
ColorTable.ColorChooserDialog
A class that collects option information about a change color statement using chained
methods.
|
static class |
ColorTable.ColorPair
An immutable structure to hold color pairs.
|
static class |
ColorTable.EnvironmentColorTable
The color-table associated with a certain environment.
|
private static class |
ColorTable.WorkArea
Context-local data for this color manager.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COLOR_KEY
Color INI file key name
|
static java.lang.String |
COLOR_SECTION
Color INI file section name
|
static java.lang.String |
COLOR_TABLE
The name of the node containing the color-table.
|
private static java.util.List<ColorTableEntry> |
defaultColorTable
Default colors.
|
private static ContextLocal<ColorTable.WorkArea> |
local
Context local instance of this class.
|
private static java.util.logging.Logger |
LOG
logger
|
static java.lang.String |
STANDARD_COLORS
The name of the node containing the color-table.
|
static java.lang.String |
SYSTEM_COLORS
The name of the node containing the color-table.
|
Constructor and Description |
---|
ColorTable() |
Modifier and Type | Method and Description |
---|---|
static handle |
asHandle()
Get an instance for the COLOR-TABLE system handle.
|
static void |
clearDirtyFlag(java.util.List<ColorTable.EnvironmentColorTable> envs)
Environments are synchronized between server and client using server state synchronization
mechanism.
|
static ColorTable.ColorChooserDialog |
createColorChooserDialog(int64 colorRef)
Factory method for creating a color chooser dialog.
|
static ColorTable.ColorChooserDialog |
createColorChooserDialog(long colorRef)
Factory method for creating a color chooser dialog.
|
static integer |
getBlueValue(int64 index)
Returns the blue component of an entry in the color table.
|
static integer |
getBlueValue(long index)
Returns the blue component of an entry in the color table.
|
static int |
getColor(java.lang.String envName,
int index)
Get RGB value for specified index from color table associate to a Window.
|
static ColorTable.EnvironmentColorTable |
getColorTable(java.lang.String envName)
Get color table of the specified environment.
|
private static ColorTableEntry |
getColorTableEntry(ColorTable.EnvironmentColorTable ect,
int index)
Get color entry for the given index.
|
private static ColorTable.EnvironmentColorTable |
getCurrentColorTable(ColorTable.WorkArea wa)
Get current environment.
|
static logical |
getDynamic(int64 index)
Returns TRUE if the entry in the color table is a dynamic color.
|
static logical |
getDynamic(long index)
Returns TRUE if the entry in the color table is a dynamic color.
|
static integer |
getGreenValue(int64 index)
Returns the green component of an entry in the color table.
|
static integer |
getGreenValue(long index)
Returns the green component of an entry in the color table.
|
static integer |
getNumEntries()
Get the number of entries in the color-table.
|
static integer |
getRedValue(int64 index)
Returns the red component of an entry in the color table.
|
static integer |
getRedValue(long index)
Returns the red component of an entry in the color table.
|
static character |
getResourceType()
Get the type of its associated handle.
|
static integer |
getRgbValue(int64 index)
Returns the rgb component of an entry in the color table.
|
static integer |
getRgbValue(long index)
Returns the rgb component of an entry in the color table.
|
static ColorTableEntry[] |
getSystemColors()
Get system colors table.
|
static java.lang.Long |
id()
Get this resource's ID.
|
static void |
id(long id)
Set this resource's ID.
|
static handle |
instantiatingProcedure()
Getter for the INSTANTIATING-PROCEDURE attribute.
|
private static ColorTableEntry[] |
loadColorTable(java.util.Map<java.lang.Integer,ColorRgb> userSystemColors,
boolean custom)
Load color-table from server directory or from environment.
|
private static ColorTable.ColorPair |
loadStandardColor(java.lang.String name,
int fgColor,
int bgColor)
Load a standard color NORMAL, INPUT or MESSAGES.
|
private static ColorTableEntry[] |
loadSystemColors()
Load system-colors from server directory.
|
private static ColorTable.WorkArea |
locate()
Locate the context-local data of this class.
|
private static void |
log(int n,
java.lang.String reason)
Log warning messages related to color mapping errors building color tables.
|
private static ColorTableEntry[] |
makeColorTable(java.lang.String[] colors,
java.util.Map<java.lang.Integer,ColorRgb> userSystemColors)
Make a collection of ColorTableEntry items from color strings.
|
private static ColorTable.EnvironmentColorTable |
readColorTable(java.util.Map<java.lang.Integer,ColorRgb> userSystemColors,
boolean custom)
Load color table from current environment.
|
static void |
readOnlyError(java.lang.String attribute)
API needed to implement read-only attribute assignment (a 4GL
"feature").
|
static void |
registerWindow(WindowConfig window)
Call when a new window is created.
|
static integer |
rgbValue(int64 r,
int64 g,
int64 b)
Returns an integer that represents a combination of a red, green, and blue color value.
|
static integer |
rgbValue(int r,
int g,
int b)
Returns an integer that represents a combination of a red, green, and blue color value.
|
static void |
saveColor(int64 colorNum)
Save the the specified color, from the user's color-table, to the environment.
|
static void |
saveColor(long colorNum)
Save the the specified color, from the user's color-table, to the environment.
|
static void |
saveColorTable()
Save the user's color-table to the environment.
|
static logical |
setBlueValue(int64 index,
int64 blueValue)
Specifies the blue component of an entry in the color table.
|
static logical |
setBlueValue(int64 index,
long blueValue)
Specifies the blue component of an entry in the color table.
|
static logical |
setBlueValue(long index,
int64 blueValue)
Specifies the blue component of an entry in the color table.
|
static logical |
setBlueValue(long index,
long blueValue)
Specifies the blue component of an entry in the color table.
|
static logical |
setDynamic(int64 index,
boolean dynamic)
Sets a color entry to a dynamic or static color.
|
static logical |
setDynamic(int64 index,
logical dynamic)
Sets a color entry to a dynamic or static color.
|
static logical |
setDynamic(long index,
boolean dynamic)
Sets a color entry to a dynamic or static color.
|
static logical |
setDynamic(long index,
logical dynamic)
Sets a color entry to a dynamic or static color.
|
static logical |
setGreenValue(int64 index,
int64 greenValue)
Specifies the green component of an entry in the color table.
|
static logical |
setGreenValue(int64 index,
long greenValue)
Specifies the green component of an entry in the color table.
|
static logical |
setGreenValue(long index,
int64 greenValue)
Specifies the green component of an entry in the color table.
|
static logical |
setGreenValue(long index,
long greenValue)
Specifies the green component of an entry in the color table.
|
static void |
setNumEntries(int64 numEntries)
Set the number of entries in the color-table.
|
static void |
setNumEntries(long numEntries)
Set the number of entries in the color-table.
|
static logical |
setRedValue(int64 index,
int64 redValue)
Specifies the red component of an entry in the color table.
|
static logical |
setRedValue(int64 index,
long redValue)
Specifies the red component of an entry in the color table.
|
static logical |
setRedValue(long index,
int64 redValue)
Specifies the red component of an entry in the color table.
|
static logical |
setRedValue(long index,
long redValue)
Specifies the red component of an entry in the color table.
|
static logical |
setRgbValue(int64 index,
int64 rgbValue)
Specifies a combination of the red, green, and blue values of an entry in the color table.
|
static logical |
setRgbValue(int64 index,
long rgbValue)
Specifies a combination of the red, green, and blue values of an entry in the color table.
|
static logical |
setRgbValue(long index,
int64 rgbValue)
Specifies a combination of the red, green, and blue values of an entry in the color table.
|
static logical |
setRgbValue(long index,
long rgbValue)
Specifies a combination of the red, green, and blue values of an entry in the color table.
|
private static void |
synch(ColorTable.EnvironmentColorTable ect)
Synchronize environments.
|
static boolean |
unknown()
Implementation for the
WrappedResource.unknown() API. |
static void |
unload(java.lang.String envName)
Unload environment.
|
static void |
use(java.lang.String envName)
Set current environment name.
|
static boolean |
valid()
Implementation for the
WrappedResource.valid() API. |
private static void |
warning(java.lang.String attribute)
Display a warning message if the attribute was not set.
|
private static final java.util.logging.Logger LOG
public static final java.lang.String COLOR_SECTION
public static final java.lang.String COLOR_KEY
public static final java.lang.String COLOR_TABLE
public static final java.lang.String STANDARD_COLORS
public static final java.lang.String SYSTEM_COLORS
private static final java.util.List<ColorTableEntry> defaultColorTable
private static final ContextLocal<ColorTable.WorkArea> local
public static ColorTableEntry[] getSystemColors()
public static ColorTable.EnvironmentColorTable getColorTable(java.lang.String envName)
envName
- Environment name. Could be null
if is default environment.public static handle instantiatingProcedure()
The returned handle will refer a valid external procedure (persistent or not) or will be unknown, in case its instantiating procedure was persistent and has been deleted.
public static void readOnlyError(java.lang.String attribute)
attribute
- The attribute's name.handle.readOnlyError(handle, String)
public static character getResourceType()
public static handle asHandle()
StaticProxy.obtain(Class, Class[])
, using the
ColorTableResource
interface and its methods implemented by these
classes: ColorTable
.public static java.lang.Long id()
public static void id(long id)
This is a no-op for system handles.
id
- The resource's ID.public static boolean valid()
WrappedResource.valid()
API.public static boolean unknown()
WrappedResource.unknown()
API.public static integer getNumEntries()
public static void setNumEntries(long numEntries)
numEntries
- The new size of the color-table.public static void setNumEntries(int64 numEntries)
numEntries
- The new size of the color-table.public static integer getRedValue(int64 index)
index
- An integer expression that specifies an entry in the color table.public static integer getRedValue(long index)
index
- An integer expression that specifies an entry in the color table.public static logical setRedValue(int64 index, int64 redValue)
index
- An integer expression that specifies an entry in the color table.redValue
- An integer expression that specifies the red RGB component of an entry in the
color table. The value must be in the range 0 to 255.public static logical setRedValue(int64 index, long redValue)
index
- An integer expression that specifies an entry in the color table.redValue
- An integer expression that specifies the red RGB component of an entry in the
color table. The value must be in the range 0 to 255.public static logical setRedValue(long index, int64 redValue)
index
- An integer expression that specifies an entry in the color table.redValue
- An integer expression that specifies the red RGB component of an entry in the
color table. The value must be in the range 0 to 255.public static logical setRedValue(long index, long redValue)
index
- An integer expression that specifies an entry in the color table.redValue
- An integer expression that specifies the red RGB component of an entry in the
color table. The value must be in the range 0 to 255.public static integer getGreenValue(int64 index)
index
- An integer expression that specifies an entry in the color table.public static integer getGreenValue(long index)
index
- An integer expression that specifies an entry in the color table.public static logical setGreenValue(int64 index, int64 greenValue)
index
- An integer expression that specifies an entry in the color table.greenValue
- An integer expression that specifies the green RGB component of an entry in the
color table. The value must be in the range 0 to 255.public static logical setGreenValue(int64 index, long greenValue)
index
- An integer expression that specifies an entry in the color table.greenValue
- An integer expression that specifies the green RGB component of an entry in the
color table. The value must be in the range 0 to 255.public static logical setGreenValue(long index, int64 greenValue)
index
- An integer expression that specifies an entry in the color table.greenValue
- An integer expression that specifies the green RGB component of an entry in the
color table. The value must be in the range 0 to 255.public static logical setGreenValue(long index, long greenValue)
index
- An integer expression that specifies an entry in the color table.greenValue
- An integer expression that specifies the green RGB component of an entry in the
color table. The value must be in the range 0 to 255.public static integer getBlueValue(int64 index)
index
- An integer expression that specifies an entry in the color table.public static integer getBlueValue(long index)
index
- An integer expression that specifies an entry in the color table.public static logical setBlueValue(int64 index, int64 blueValue)
index
- An integer expression that specifies an entry in the color table.blueValue
- An integer expression that specifies the blue RGB component of an entry in the
color table. The value must be in the range 0 to 255.public static logical setBlueValue(int64 index, long blueValue)
index
- An integer expression that specifies an entry in the color table.blueValue
- An integer expression that specifies the blue RGB component of an entry in the
color table. The value must be in the range 0 to 255.public static logical setBlueValue(long index, int64 blueValue)
index
- An integer expression that specifies an entry in the color table.blueValue
- An integer expression that specifies the blue RGB component of an entry in the
color table. The value must be in the range 0 to 255.public static logical setBlueValue(long index, long blueValue)
index
- An integer expression that specifies an entry in the color table.blueValue
- An integer expression that specifies the blue RGB component of an entry in the
color table. The value must be in the range 0 to 255.public static integer getRgbValue(int64 index)
index
- An integer expression that specifies an entry in the color table.public static integer getRgbValue(long index)
index
- An integer expression that specifies an entry in the color table.public static logical setRgbValue(int64 index, int64 rgbValue)
index
- An integer expression that specifies an entry in the color table.rgbValue
- An integer expression that specifies the RGB component of an entry in the color
table. You can obtain this value from the color property of an ActiveX control,
by using the RGB-VALUE function, or by using the GET-RGB-VALUE() method.public static logical setRgbValue(int64 index, long rgbValue)
index
- An integer expression that specifies an entry in the color table.rgbValue
- An integer expression that specifies the RGB component of an entry in the color
table. You can obtain this value from the color property of an ActiveX control,
by using the RGB-VALUE function, or by using the GET-RGB-VALUE() method.public static logical setRgbValue(long index, int64 rgbValue)
index
- An integer expression that specifies an entry in the color table.rgbValue
- An integer expression that specifies the RGB component of an entry in the color
table. You can obtain this value from the color property of an ActiveX control,
by using the RGB-VALUE function, or by using the GET-RGB-VALUE() method.public static logical setRgbValue(long index, long rgbValue)
index
- An integer expression that specifies an entry in the color table.rgbValue
- An integer expression that specifies the RGB component of an entry in the color
table. You can obtain this value from the color property of an ActiveX control,
by using the RGB-VALUE function, or by using the GET-RGB-VALUE() method.public static logical getDynamic(int64 index)
index
- An integer expression that specifies an entry in the color table.public static logical getDynamic(long index)
index
- An integer expression that specifies an entry in the color table.public static logical setDynamic(int64 index, logical dynamic)
index
- An integer expression that specifies an entry in the color table.dynamic
- Logical expression that specifies the dynamic status of an entry in the color
table. If dynamic is TRUE sets the entry to a dynamic color and sets the entry
to a static color if dynamic is FALSE.public static logical setDynamic(int64 index, boolean dynamic)
index
- An integer expression that specifies an entry in the color table.dynamic
- Logical expression that specifies the dynamic status of an entry in the color
table. If dynamic is TRUE sets the entry to a dynamic color and sets the entry
to a static color if dynamic is FALSE.public static logical setDynamic(long index, logical dynamic)
index
- An integer expression that specifies an entry in the color table.dynamic
- Logical expression that specifies the dynamic status of an entry in the color
table. If dynamic is TRUE sets the entry to a dynamic color and sets the entry
to a static color if dynamic is FALSE.public static logical setDynamic(long index, boolean dynamic)
index
- An integer expression that specifies an entry in the color table.dynamic
- Logical expression that specifies the dynamic status of an entry in the color
table. If dynamic is TRUE sets the entry to a dynamic color and sets the entry
to a static color if dynamic is FALSE.public static int getColor(java.lang.String envName, int index)
envName
- Environment name.index
- Color table index.public static void saveColorTable()
public static void saveColor(long colorNum)
PUT-KEY-VALUE COLOR color-num
statement.colorNum
- The color-table entry to be saved.public static void saveColor(int64 colorNum)
PUT-KEY-VALUE COLOR color-num
statement.colorNum
- The color-table entry to be saved.public static ColorTable.ColorChooserDialog createColorChooserDialog(int64 colorRef)
colorRef
- The color to be presented to user and changed if the dialog returned is accepted.ColorTable.ColorChooserDialog.execute()
on this will
result the client to display a theme specific color chooser dialog.public static ColorTable.ColorChooserDialog createColorChooserDialog(long colorRef)
colorRef
- The color to be presented to user and changed if the dialog returned is accepted.ColorTable.ColorChooserDialog.execute()
on this will
result the client to display a theme specific color chooser dialog.public static integer rgbValue(int r, int g, int b)
Return value is calculated as follow: red + green << 8 + blue << 16
This is the implementation of RGB-VALUE
function.
r
- Red value.g
- Green value.b
- Blue value.public static integer rgbValue(int64 r, int64 g, int64 b)
Return value is calculated as follow: red + green << 8 + blue << 16
This is the implementation of RGB-VALUE
function.
r
- Red value.g
- Green value.b
- Blue value.public static void clearDirtyFlag(java.util.List<ColorTable.EnvironmentColorTable> envs)
LogicalTerminal.getChanges()
envs
- Environments list.public static void registerWindow(WindowConfig window)
window
- Window configuration.public static void use(java.lang.String envName)
USE environment
statement is executed.envName
- Environment name.public static void unload(java.lang.String envName)
UNLOAD environment
statement is executed.envName
- Environment name.private static void warning(java.lang.String attribute)
attribute
- Attribute name.private static ColorTableEntry[] loadColorTable(java.util.Map<java.lang.Integer,ColorRgb> userSystemColors, boolean custom)
userSystemColors
- User system colors.custom
- If false
get default form server directory.private static ColorTableEntry[] loadSystemColors()
private static ColorTable.ColorPair loadStandardColor(java.lang.String name, int fgColor, int bgColor)
name
- Standard color name.fgColor
- Default foreground color.bgColor
- Default background color.private static ColorTableEntry[] makeColorTable(java.lang.String[] colors, java.util.Map<java.lang.Integer,ColorRgb> userSystemColors)
Color table strings are in the following format: colorn = { R , G , B , | colorname } where: - n color number (max. 255) - R, G and B are red, green and blue integer values example 127,0,127 - colorname is the name of a system color example COLOR-SCROLLBAR
colors
- Color strings.userSystemColors
- User system colors.private static void log(int n, java.lang.String reason)
n
- Color number.reason
- A string specifying the reason of the warning message.private static ColorTable.WorkArea locate()
ColorTable.WorkArea
instance.private static ColorTableEntry getColorTableEntry(ColorTable.EnvironmentColorTable ect, int index)
ect
- Environment color table.index
- Color table index.private static ColorTable.EnvironmentColorTable readColorTable(java.util.Map<java.lang.Integer,ColorRgb> userSystemColors, boolean custom)
userSystemColors
- User system colors.custom
- If false
get default form server directory.private static void synch(ColorTable.EnvironmentColorTable ect)
ect
- Environment to synchronize.private static ColorTable.EnvironmentColorTable getCurrentColorTable(ColorTable.WorkArea wa)
wa
- Work area instance.