Compiere 3.1

org.compiere.util
Class Ctx

java.lang.Object
  extended by org.compiere.util.Ctx
All Implemented Interfaces:
Serializable, Map<String,String>, Evaluatee
Direct Known Subclasses:
CContext

public class Ctx
extends Object
implements Map<String,String>, Evaluatee, Serializable

Context

Version:
$Id$
Author:
Jorg Janke
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
static CompiereLogger log
          Logger
protected  HashMap<String,String> m_map
          The Map
 
Constructor Summary
Ctx()
          Context
Ctx(Map<String,String> map)
          Context
Ctx(Set<Map.Entry<String,String>> set)
          Context
Ctx(String stringRepresentation)
          Context
 
Method Summary
 void clear()
          clear
 boolean containsKey(Object key)
          Contains Key
 boolean containsValue(Object value)
          Contains Value
 void copyContext(int from_windowNO, int to_windowNO, String context)
          Copy the designated context variable from one windowNO to another
 void deletePreference(String attribute, String attributeValue)
          Remove Preferences
 Set<Map.Entry<String,String>> entrySet()
          entrySet
 String get_ValueAsString(String variableName)
          Evaluatee
 String get(Object key)
          get
 int getAD_Client_ID()
          Get Login AD_Client_ID
 int getAD_Client_ID(int WindowNo)
          Get AD_Client_ID
 int getAD_Org_ID()
          Get Login AD_Org_ID
 int getAD_Org_ID(int WindowNo)
          Get Window AD_Org_ID
 int getAD_Org_ID(int WindowNo, int TabNo)
          Get Tab AD_Org_ID
 int getAD_Role_ID()
          Get Login AD_Role_ID
 int getAD_User_ID()
          Get Login AD_User_ID
 String getContext(int WindowNo, int TabNo, String context)
          Get Value of Context for Window & Tab, if not found global context if available
 String getContext(int WindowNo, String context)
          Get Value of Context for Window.
 String getContext(int WindowNo, String context, boolean onlyWindow)
          Get Value of Context for Window.
 String getContext(String context)
          Get global Value of Context
 int getContextAsInt(int WindowNo, int TabNo, String context)
          Get Context and convert it to an integer (0 if error)
 int getContextAsInt(int WindowNo, String context)
          Get Context and convert it to an integer (0 if error)
 int getContextAsInt(String context)
          Get Context and convert it to an integer (0 if error)
 long getContextAsTime(int WindowNo, String context)
          Get Context and convert it to a Timestamp if error return today's date
 long getContextAsTime(String context)
          Get Context and convert it to a Timestamp if error return today's date
 Ctx getCtx(int windowNo)
          Get Ctx with just Window data and basic context
 String[] getEntireContext()
          Get sorted Context as String array with format: key == value
protected  Map<String,String> getMap()
          Get Map
 Map<String,String> getMap(int windowNo)
          Get Map with spaces as null
 Map<String,String> getMap(int windowNo, boolean convertNullToEmptyString)
          Get Map with just Window data and basic context
 String getPrinterName()
          Get Printer Name
 int getStdPrecision()
          Get Primary Accounting Schema Currency Precision
 String getUITheme()
           
 boolean isActive(int WindowNo)
          Is Active
 boolean isAutoCommit()
          Is AutoCommit
 boolean isAutoCommit(int WindowNo)
          Is Window AutoCommit (if not set use default)
 boolean isAutoNew()
          Is Auto New Record
 boolean isAutoNew(int WindowNo)
          Is Window Auto New Record (if not set use default)
 boolean isEmpty()
          isEmpty
 boolean isProcessed(int WindowNo)
          Is Processed
 boolean isProcessing(int WindowNo)
          Is Processing
 boolean isShowAdvanced()
           
 boolean isSOTrx()
          Is Sales Order Trx
 boolean isSOTrx(int WindowNo)
          Is Sales Order Trx
 Set<String> keySet()
          keySet
protected  void load(String stringRepresentation)
          Load
 String put(String key, String value)
          Set Context key / value
 void putAll(Map<? extends String,? extends String> map)
          Put All
 String remove(Object key)
          remove
 void removeWindow(int windowNo)
          Remove context for Window (i.e. delete it)
 void setAD_Client_ID(int AD_Client_ID)
          Set Login AD_Client_ID
 void setAD_Org_ID(int AD_Org_ID)
          Set Login AD_Org_ID
 void setAD_Role_ID(int AD_Role_ID)
          Set Login AD_Role_ID
 void setAD_User_ID(int AD_User_ID)
          Set Login AD_User_ID
 void setAutoCommit(boolean autoCommit)
          Set Auto Commit
 void setAutoCommit(int WindowNo, boolean autoCommit)
          Set Auto Commit for Window
 void setAutoNew(boolean autoNew)
          Set Auto New Record
 void setAutoNew(int WindowNo, boolean autoNew)
          Set Auto New Record for Window
 void setContext(int WindowNo, int TabNo, String context, String value)
          Set Context for Window & Tab to Value
 void setContext(int WindowNo, Map<String,String> addContext)
          Add Map elements to context
 void setContext(int WindowNo, String context, boolean value)
          Set Context for Window to Y/N Value
 void setContext(int WindowNo, String context, Date value)
          Set Context for Window to Value
 void setContext(int WindowNo, String context, int value)
          Set Context for Window to int Value
 void setContext(int WindowNo, String context, String value)
          Set Context for Window to Value
 Object setContext(String context, boolean value)
          Set Global Context to Y/N Value
 Object setContext(String context, Date value)
          Set Global Context to Value
 Object setContext(String context, int value)
          Set Global Context to (int) Value
 String setContext(String context, String value)
          Set Global Context to Value
 void setIsSOTrx(boolean isSOTrx)
          Set SO Trx
 void setIsSOTrx(int WindowNo, boolean isSOTrx)
          Set SO Trx
 void setPrinterName(String printerName)
          Set Printer Name
 void setShowAdvanced(boolean showAdvanced)
           
 void setStdPrecision(int precision)
          Set Primary Accounting Schema Currency Precision
 void setUITheme(String value)
           
 int size()
          Size
 String toString()
          Extended String Info
 String toStringShort()
          String Info
 Collection<String> values()
          values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

m_map

protected HashMap<String,String> m_map
The Map


log

public static CompiereLogger log
Logger

Constructor Detail

Ctx

public Ctx()
Context


Ctx

public Ctx(Map<String,String> map)
Context

Parameters:
map - context (clone)

Ctx

public Ctx(String stringRepresentation)
Context

Parameters:
stringRepresentation - example {AD_Org_ID=11}

Ctx

public Ctx(Set<Map.Entry<String,String>> set)
Context

Parameters:
set - set of Map.Entry
Method Detail

load

protected void load(String stringRepresentation)
Load

Parameters:
stringRepresentation - example {AD_Org_ID=11, IsDefault=N, IsActive=Y, Greeting=Mr, Name=Mr, C_Greeting_ID=100, AD_Client_ID=11, IsFirstNameOnly=N}

setContext

public String setContext(String context,
                         String value)
Set Global Context to Value

Parameters:
context - context key
value - context value
Returns:
old value

setContext

public Object setContext(String context,
                         Date value)
Set Global Context to Value

Parameters:
ctx - context
context - context key
value - context value

setContext

public Object setContext(String context,
                         int value)
Set Global Context to (int) Value

Parameters:
ctx - context
context - context key
value - context value

setContext

public Object setContext(String context,
                         boolean value)
Set Global Context to Y/N Value

Parameters:
ctx - context
context - context key
value - context value

setContext

public void setContext(int WindowNo,
                       String context,
                       String value)
Set Context for Window to Value

Parameters:
WindowNo - window no
context - context key
value - context value

setContext

public void setContext(int WindowNo,
                       Map<String,String> addContext)
Add Map elements to context

Parameters:
WindowNo - window
addContext - new context

setContext

public void setContext(int WindowNo,
                       String context,
                       Date value)
Set Context for Window to Value

Parameters:
WindowNo - window no
context - context key
value - context value

setContext

public void setContext(int WindowNo,
                       String context,
                       int value)
Set Context for Window to int Value

Parameters:
WindowNo - window no
context - context key
value - context value

setContext

public void setContext(int WindowNo,
                       String context,
                       boolean value)
Set Context for Window to Y/N Value

Parameters:
WindowNo - window no
context - context key
value - context value

setContext

public void setContext(int WindowNo,
                       int TabNo,
                       String context,
                       String value)
Set Context for Window & Tab to Value

Parameters:
WindowNo - window no
TabNo - tab no
context - context key
value - context value

setAutoCommit

public void setAutoCommit(boolean autoCommit)
Set Auto Commit

Parameters:
autoCommit - auto commit (save)

setAutoCommit

public void setAutoCommit(int WindowNo,
                          boolean autoCommit)
Set Auto Commit for Window

Parameters:
WindowNo - window no
autoCommit - auto commit (save)

setAutoNew

public void setAutoNew(boolean autoNew)
Set Auto New Record

Parameters:
autoNew - auto new record

setAutoNew

public void setAutoNew(int WindowNo,
                       boolean autoNew)
Set Auto New Record for Window

Parameters:
ctx - context
WindowNo - window no
autoNew - auto new record

setIsSOTrx

public void setIsSOTrx(boolean isSOTrx)
Set SO Trx

Parameters:
isSOTrx - SO Context

setIsSOTrx

public void setIsSOTrx(int WindowNo,
                       boolean isSOTrx)
Set SO Trx

Parameters:
WindowNo - window no
isSOTrx - SO Context

getStdPrecision

public int getStdPrecision()
Get Primary Accounting Schema Currency Precision

Returns:
std precision

setStdPrecision

public void setStdPrecision(int precision)
Set Primary Accounting Schema Currency Precision

Parameters:
precision - std precision

setPrinterName

public void setPrinterName(String printerName)
Set Printer Name

Parameters:
printerName - printer

getPrinterName

public String getPrinterName()
Get Printer Name

Returns:
printer

getContext

public String getContext(String context)
Get global Value of Context

Parameters:
ctx - context
context - context key
Returns:
value or ""

getContext

public String getContext(int WindowNo,
                         String context,
                         boolean onlyWindow)
Get Value of Context for Window. if not found global context if available and enabled

Parameters:
WindowNo - window
context - context key
onlyWindow - if true, no defaults are used unless explicitly asked for
Returns:
value or ""

getContext

public String getContext(int WindowNo,
                         String context)
Get Value of Context for Window. if not found global context if available

Parameters:
WindowNo - window
context - context key
Returns:
value or ""

getContext

public String getContext(int WindowNo,
                         int TabNo,
                         String context)
Get Value of Context for Window & Tab, if not found global context if available

Parameters:
WindowNo - window no
TabNo - tab no
context - context key
Returns:
value or ""

getContextAsInt

public int getContextAsInt(String context)
Get Context and convert it to an integer (0 if error)

Parameters:
context - context key
Returns:
value

getContextAsInt

public int getContextAsInt(int WindowNo,
                           String context)
Get Context and convert it to an integer (0 if error)

Parameters:
ctx - context
WindowNo - window no
context - context key
Returns:
value or 0

getContextAsInt

public int getContextAsInt(int WindowNo,
                           int TabNo,
                           String context)
Get Context and convert it to an integer (0 if error)

Parameters:
WindowNo - window no
TabNo - tab no
context - context key
Returns:
value or 0

isAutoCommit

public boolean isAutoCommit()
Is AutoCommit

Returns:
true if auto commit

isAutoCommit

public boolean isAutoCommit(int WindowNo)
Is Window AutoCommit (if not set use default)

Parameters:
WindowNo - window no
Returns:
true if auto commit

isAutoNew

public boolean isAutoNew()
Is Auto New Record

Returns:
true if auto new

isAutoNew

public boolean isAutoNew(int WindowNo)
Is Window Auto New Record (if not set use default)

Parameters:
WindowNo - window no
Returns:
true if auto new record

isSOTrx

public boolean isSOTrx()
Is Sales Order Trx

Returns:
true if SO (default)

isSOTrx

public boolean isSOTrx(int WindowNo)
Is Sales Order Trx

Parameters:
WindowNo - window no
Returns:
true if SO (default)

getContextAsTime

public long getContextAsTime(String context)
Get Context and convert it to a Timestamp if error return today's date

Parameters:
context - context key
Returns:
Time

getContextAsTime

public long getContextAsTime(int WindowNo,
                             String context)
Get Context and convert it to a Timestamp if error return today's date

Parameters:
WindowNo - window no
context - context key
Returns:
Time

getAD_Client_ID

public int getAD_Client_ID()
Get Login AD_Client_ID

Returns:
login AD_Client_ID

setAD_Client_ID

public void setAD_Client_ID(int AD_Client_ID)
Set Login AD_Client_ID

Parameters:
AD_Client_ID - client

getAD_Client_ID

public int getAD_Client_ID(int WindowNo)
Get AD_Client_ID

Parameters:
WindowNo - Window
Returns:
login AD_Client_ID

getAD_Org_ID

public int getAD_Org_ID()
Get Login AD_Org_ID

Returns:
login AD_Org_ID

setAD_Org_ID

public void setAD_Org_ID(int AD_Org_ID)
Set Login AD_Org_ID

Parameters:
AD_Org_ID - org

getAD_Org_ID

public int getAD_Org_ID(int WindowNo)
Get Window AD_Org_ID

Parameters:
WindowNo - window
Returns:
login AD_Org_ID

getAD_Org_ID

public int getAD_Org_ID(int WindowNo,
                        int TabNo)
Get Tab AD_Org_ID

Parameters:
WindowNo - window
TabNo - tab
Returns:
login AD_Org_ID

getAD_User_ID

public int getAD_User_ID()
Get Login AD_User_ID

Returns:
login AD_User_ID

setAD_User_ID

public void setAD_User_ID(int AD_User_ID)
Set Login AD_User_ID

Parameters:
AD_User_ID - user

getAD_Role_ID

public int getAD_Role_ID()
Get Login AD_Role_ID

Returns:
login AD_Role_ID

setAD_Role_ID

public void setAD_Role_ID(int AD_Role_ID)
Set Login AD_Role_ID

Parameters:
AD_Role_ID - role

isProcessed

public boolean isProcessed(int WindowNo)
Is Processed

Returns:
true if processed

isProcessing

public boolean isProcessing(int WindowNo)
Is Processing

Returns:
true if processing

isActive

public boolean isActive(int WindowNo)
Is Active

Returns:
true if active

size

public int size()
Size

Specified by:
size in interface Map<String,String>
Returns:
size of context

toStringShort

public String toStringShort()
String Info

Returns:
info

toString

public String toString()
Extended String Info

Overrides:
toString in class Object
Returns:
info

getEntireContext

public String[] getEntireContext()
Get sorted Context as String array with format: key == value

Parameters:
ctx - context
Returns:
context string

get_ValueAsString

public String get_ValueAsString(String variableName)
Evaluatee

Specified by:
get_ValueAsString in interface Evaluatee
Parameters:
variableName - key
Returns:
value

getCtx

public Ctx getCtx(int windowNo)
Get Ctx with just Window data and basic context

Parameters:
windowNo -
Returns:
new context

getMap

public Map<String,String> getMap(int windowNo)
Get Map with spaces as null

Parameters:
windowNo - window no
Returns:
map

getMap

public Map<String,String> getMap(int windowNo,
                                 boolean convertNullToEmptyString)
Get Map with just Window data and basic context

Parameters:
windowNo - window
Returns:
map

removeWindow

public void removeWindow(int windowNo)
Remove context for Window (i.e. delete it)

Parameters:
windowNo - window

deletePreference

public void deletePreference(String attribute,
                             String attributeValue)
Remove Preferences

Parameters:
attribute - attribute
attributeValue - value

clear

public void clear()
clear

Specified by:
clear in interface Map<String,String>
See Also:
Map.clear()

containsKey

public boolean containsKey(Object key)
Contains Key

Specified by:
containsKey in interface Map<String,String>
Parameters:
key - key
Returns:
true if contains key

containsValue

public boolean containsValue(Object value)
Contains Value

Specified by:
containsValue in interface Map<String,String>
Parameters:
value -
Returns:

entrySet

public Set<Map.Entry<String,String>> entrySet()
entrySet

Specified by:
entrySet in interface Map<String,String>
Returns:

get

public String get(Object key)
get

Specified by:
get in interface Map<String,String>
Parameters:
key -
Returns:

isEmpty

public boolean isEmpty()
isEmpty

Specified by:
isEmpty in interface Map<String,String>
Returns:

keySet

public Set<String> keySet()
keySet

Specified by:
keySet in interface Map<String,String>
Returns:

put

public String put(String key,
                  String value)
Set Context key / value

Specified by:
put in interface Map<String,String>
Parameters:
key -
value -
Returns:
old value

putAll

public void putAll(Map<? extends String,? extends String> map)
Put All

Specified by:
putAll in interface Map<String,String>
Parameters:
arg0 -

remove

public String remove(Object key)
remove

Specified by:
remove in interface Map<String,String>
Parameters:
key -
Returns:

values

public Collection<String> values()
values

Specified by:
values in interface Map<String,String>
Returns:

getMap

protected Map<String,String> getMap()
Get Map

Returns:
map

copyContext

public void copyContext(int from_windowNO,
                        int to_windowNO,
                        String context)
Copy the designated context variable from one windowNO to another

Parameters:
windowNo -
window_info -
string -

getUITheme

public String getUITheme()

setUITheme

public void setUITheme(String value)

isShowAdvanced

public boolean isShowAdvanced()

setShowAdvanced

public void setShowAdvanced(boolean showAdvanced)

Compiere 3.1

Compiere® is a registered trademark of ComPiere, Inc. ©2004-2008 HumanFlash.com All rights reserved.