Compiere 3.1

org.compiere.util
Class Env

java.lang.Object
  extended by org.compiere.common.constants.EnvConstants
      extended by org.compiere.util.Env

public final class Env
extends EnvConstants

System Environment and static variables

Version:
$Id: Env.java,v 1.3 2006/07/30 00:54:36 jjanke Exp $
Author:
Jorg Janke

Field Summary
static String GOOGLE_MAPS_URL_PREFIX
           
static String LANGUAGE
          Context Language identifier
static String NL
          New Line
static BigDecimal ONE
          Big Decimal 1
static BigDecimal ONEHUNDRED
          Big Decimal 100
static BigDecimal ZERO
          Big Decimal 0
 
Fields inherited from class org.compiere.common.constants.EnvConstants
TAB_INFO, WINDOW_ACCOUNT, WINDOW_CUSTOMIZE, WINDOW_FIND, WINDOW_INFO, WINDOW_MLOOKUP
 
Constructor Summary
Env()
           
 
Method Summary
static void clearContext()
          Clean up all context (i.e. delete it)
static void clearContext(Ctx ctx)
          Clean up all context (i.e. delete it)
static void clearWinContext(Ctx ctx, int WindowNo)
          Clean up context for Window (i.e. delete it)
static void clearWinContext(int WindowNo)
          Clean up context for Window (i.e. delete it)
static int createWindowNo(Container win)
          Add Container and return WindowNo.
static void exitEnv(int status)
          Exit System
static String getAD_Language(Ctx ctx)
          Get System AD_Language
static Ctx getCtx()
          Get Client Context
static JFrame getFrame(Container container)
          Get Frame of Window
static Graphics getGraphics(Container container)
          Get Graphics of container or its parent.
static String getHeader(Ctx ctx, int WindowNo)
          Get Header info (connection, org, user)
static Image getImage(String fileNameInImageDir)
          Get Image with File name
static ImageIcon getImageIcon(String fileNameInImageDir)
          Get ImageIcon.
static Language getLanguage(Ctx ctx)
          Get System Language
static Language getLoginLanguage(Ctx ctx)
          Get Login Language
static Window getParent(Container container)
          Return JDialog or JFrame Parent
static String getPreference(Ctx ctx, int AD_Window_ID, String context, boolean system)
          Get Preference.
static JFrame getWindow(int WindowNo)
          Return the JFrame pointer of WindowNo - or null
static int getWindowNo(Container container)
          Search Window by comparing the Frames
static boolean hideWindow(CFrame window)
          Hide Window
static boolean isBaseLanguage(Ctx ctx, String tableName)
          Check Base Language
static boolean isBaseLanguage(Language language, String tableName)
          Check Base Language
static boolean isBaseLanguage(String AD_Language, String tableName)
          Check Base Language
static boolean isBaseTranslation(String tableName)
          Table is in Base Translation (AD)
static boolean isMac()
          Do we run on Apple
static boolean isMultiLingualDocument(Ctx ctx)
          Do we have Multi-Lingual Documents.
static boolean isWindows()
          Do we run on Windows
static String parseContext(Ctx ctx, int WindowNo, String value, boolean onlyWindow)
          Parse Context replaces global or Window context @tag@ with actual value.
static String parseContext(Ctx ctx, int WindowNo, String value, boolean onlyWindow, boolean ignoreUnparsable)
          Parse Context replaces global or Window context @tag@ with actual value.
static void reset(boolean finalCall)
          Reset Cache
static boolean showWindow(int AD_Window_ID)
          Show Window
static void sleep(int sec)
          Sleep
static void startBrowser(String url)
          Start Browser
static Language verifyLanguage(Ctx ctx, Language language)
          Verify Language.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GOOGLE_MAPS_URL_PREFIX

public static String GOOGLE_MAPS_URL_PREFIX

LANGUAGE

public static final String LANGUAGE
Context Language identifier

See Also:
Constant Field Values

ZERO

public static final BigDecimal ZERO
Big Decimal 0


ONE

public static final BigDecimal ONE
Big Decimal 1


ONEHUNDRED

public static final BigDecimal ONEHUNDRED
Big Decimal 100


NL

public static final String NL
New Line

Constructor Detail

Env

public Env()
Method Detail

exitEnv

public static void exitEnv(int status)
Exit System

Parameters:
status - System exit status (usually 0 for no error)

reset

public static void reset(boolean finalCall)
Reset Cache

Parameters:
finalCall - everything otherwise login data remains

getCtx

public static final Ctx getCtx()
Get Client Context

Returns:
Properties

getPreference

public static String getPreference(Ctx ctx,
                                   int AD_Window_ID,
                                   String context,
                                   boolean system)
Get Preference.
                0)      Current Setting
                1)      Window Preference
                2)      Global Preference
                3)      Login settings
                4)      Accounting settings
  

Parameters:
ctx - context
AD_Window_ID - window no
context - Entity to search
system - System level preferences (vs. user defined)
Returns:
preference value

isBaseLanguage

public static boolean isBaseLanguage(Ctx ctx,
                                     String tableName)
Check Base Language

Parameters:
ctx - context
tableName - table to be translated
Returns:
true if base language and table not translated

isBaseLanguage

public static boolean isBaseLanguage(String AD_Language,
                                     String tableName)
Check Base Language

Parameters:
AD_Language - language
tableName - table to be translated
Returns:
true if base language and table not translated

isBaseLanguage

public static boolean isBaseLanguage(Language language,
                                     String tableName)
Check Base Language

Parameters:
language - language
tableName - table to be translated
Returns:
true if base language and table not translated

isBaseTranslation

public static boolean isBaseTranslation(String tableName)
Table is in Base Translation (AD)

Parameters:
tableName - table
Returns:
true if base trl

isMultiLingualDocument

public static boolean isMultiLingualDocument(Ctx ctx)
Do we have Multi-Lingual Documents. Set in DB.loadOrgs

Parameters:
ctx - context
Returns:
true if multi lingual documents

getAD_Language

public static String getAD_Language(Ctx ctx)
Get System AD_Language

Parameters:
ctx - context
Returns:
AD_Language eg. en_US

getLanguage

public static Language getLanguage(Ctx ctx)
Get System Language

Parameters:
ctx - context
Returns:
Language

getLoginLanguage

public static Language getLoginLanguage(Ctx ctx)
Get Login Language

Parameters:
ctx - context
Returns:
Language

verifyLanguage

public static Language verifyLanguage(Ctx ctx,
                                      Language language)
Verify Language. Check that language is supported by the system

Parameters:
ctx - might be updated with new AD_Language
language - language

getHeader

public static String getHeader(Ctx ctx,
                               int WindowNo)
Get Header info (connection, org, user)

Parameters:
ctx - context
WindowNo - window
Returns:
Header String

clearWinContext

public static void clearWinContext(Ctx ctx,
                                   int WindowNo)
Clean up context for Window (i.e. delete it)

Parameters:
ctx - context
WindowNo - window

clearContext

public static void clearContext(Ctx ctx)
Clean up all context (i.e. delete it)

Parameters:
ctx - context

parseContext

public static String parseContext(Ctx ctx,
                                  int WindowNo,
                                  String value,
                                  boolean onlyWindow,
                                  boolean ignoreUnparsable)
Parse Context replaces global or Window context @tag@ with actual value. The tag may have a | with a fixed value e.g. @C_BPartner_ID|0@

Parameters:
ctx - context
WindowNo - Number of Window
value - Message to be parsed
onlyWindow - if true, no defaults are used
ignoreUnparsable - if true, unsuccessful return parsed String or "" if not successful and ignoreUnparsable
Returns:
parsed context

parseContext

public static String parseContext(Ctx ctx,
                                  int WindowNo,
                                  String value,
                                  boolean onlyWindow)
Parse Context replaces global or Window context @tag@ with actual value.

Parameters:
ctx - context
WindowNo - Number of Window
value - Message to be parsed
onlyWindow - if true, no defaults are used
Returns:
parsed String or "" if not successful

createWindowNo

public static int createWindowNo(Container win)
Add Container and return WindowNo. The container is a APanel, AWindow or JFrame/JDialog

Parameters:
win - window
Returns:
WindowNo used for context

getWindowNo

public static int getWindowNo(Container container)
Search Window by comparing the Frames

Parameters:
container - container
Returns:
WindowNo of container or 0

getWindow

public static JFrame getWindow(int WindowNo)
Return the JFrame pointer of WindowNo - or null

Parameters:
WindowNo - window
Returns:
JFrame of WindowNo

clearWinContext

public static void clearWinContext(int WindowNo)
Clean up context for Window (i.e. delete it)

Parameters:
WindowNo - window

clearContext

public static void clearContext()
Clean up all context (i.e. delete it)


getFrame

public static JFrame getFrame(Container container)
Get Frame of Window

Parameters:
container - Container
Returns:
JFrame of container or null

getGraphics

public static Graphics getGraphics(Container container)
Get Graphics of container or its parent. The element may not have a Graphic if not displayed yet, but the parent might have.

Parameters:
container - Container
Returns:
Graphics of container or null

getParent

public static Window getParent(Container container)
Return JDialog or JFrame Parent

Parameters:
container - Container
Returns:
JDialog or JFrame of container

getImage

public static Image getImage(String fileNameInImageDir)
Get Image with File name

Parameters:
fileNameInImageDir - full file name in imgaes folder (e.g. Bean16.gif)
Returns:
image

getImageIcon

public static ImageIcon getImageIcon(String fileNameInImageDir)
Get ImageIcon.

Parameters:
fileNameInImageDir - full file name in images folder (e.g. Bean16.gif)
Returns:
image

startBrowser

public static void startBrowser(String url)
Start Browser

Parameters:
url - url

isMac

public static boolean isMac()
Do we run on Apple

Returns:
true if Mac

isWindows

public static boolean isWindows()
Do we run on Windows

Returns:
true if windows

hideWindow

public static boolean hideWindow(CFrame window)
Hide Window

Parameters:
window - window
Returns:
true if window is hidden, otherwise close it

showWindow

public static boolean showWindow(int AD_Window_ID)
Show Window

Parameters:
AD_Window_ID - window
Returns:
true if window re-displayed

sleep

public static void sleep(int sec)
Sleep

Parameters:
sec - seconds

Compiere 3.1

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