Package org.adempiere.webui.apps
Class AEnv
java.lang.Object
org.adempiere.webui.apps.AEnv
Static application environment and utilities methods.
- Author:
- Jorg Janke Colin Rooney (croo) and kstan_79 RFE#1670185
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
actionDrill
(DrillEvent.DrillData data, int windowNo) Opens the Drill Assistantstatic void
actionDrill
(DrillEvent.DrillData data, int windowNo, int processID) Opens the Drill Assistantstatic void
actionRefresh
(Lookup lookup, Object value, boolean mandatory, boolean shortList) Refresh lookupstatic void
actionZoom
(Lookup lookup, Object value) Zoom to AD Windowstatic void
cacheReset
(String tableName, int Record_ID) Cache Resetstatic boolean
contains
(org.zkoss.zk.ui.Component parent, org.zkoss.zk.ui.Component child) Is parent == child or parent is ancestor of child.static void
detachInputElement
(org.zkoss.zk.ui.Component parent) Workaround for detached HTML input element leak.static void
executeAsyncDesktopTask
(Runnable runnable) Execute asynchronous task in UI thread.static void
executeDesktopTask
(Runnable runnable) Execute synchronous task in UI thread.
UseExecutions.activate(Desktop)
andExecutions.deactivate(Desktop)
pair if current thread is not UI/Listener thread.static void
exit
(int status) Deprecated, for removal: This API element is subject to removal in a future version.static int
getADWindowID
(int windowNo) Get AD_Window_ID from windowNo.static String
static org.zkoss.zk.ui.Desktop
Get current desktop.
Get from current executions (Executions.getCurrent()) if current thread is UI thread.
Otherwise, get fromDesktopRunnable.getThreadLocalDesktop()
.static String
getDialogHeader
(Properties ctx, int windowNo) static String
getDialogHeader
(Properties ctx, int windowNo, String prefix) Get title for dialog windowstatic URI
Get ImageIcon.static Language
getLanguage
(Properties ctx) Get language of contextstatic WTableDirEditor
getListDocumentLanguage
(MClient client) Create WTableDirEditor for language with IsLoginLocale=Y.static Locale
getLocale
(Properties ctx) Get locale of contextstatic char
getMnemonic
(String text) Get Mnemonic character from text.static GridWindowVO
getMWindowVO
(int WindowNo, int AD_Window_ID, int AD_Menu_ID) Get VO for AD_Windowstatic boolean
getOrSetExecutionAttribute
(String attribute) Set attribute value to Boolean.TRUE if attribute doesn't exists in current execution yet.static String
getWindowHeader
(Properties ctx, int WindowNo) Get window titlestatic String
getZoomUrlTableID
(PO po) Get link for direct access to the record using AD_Table_ID+Record_IDstatic String
Get link for direct access to the record using TableName+Record_IDstatic String
getZoomUrlTableUU
(PO po) Get link for direct access to the record using AD_Table_ID+Record_UUIDstatic boolean
Deprecated.See IDEMPIERE-1022static boolean
Deprecated.static boolean
Deprecated.static boolean
isTablet()
Deprecated, for removal: This API element is subject to removal in a future version.replace by ClientInfo.isMobile()static void
logout()
Logout AD_Session and clearwindowCache
.static void
Merge pdfList to outFilestatic String
postImmediate
(int WindowNo, int AD_Client_ID, int AD_Table_ID, int Record_ID, boolean force) Post Immediate.
CallDoc.manualPosting(int, int, int, int, boolean)
.static void
showCenterScreen
(Window window) Show window in the center of screen.static void
showCenterWindow
(Window parent, Window window) Show window in center of the parent window.static void
showScreen
(Window window, String position) Show window at position (Window.setPosition(String)
) and show it.static void
showWindow
(Window win) Show window in desktop.static void
showZoomWindow
(int AD_Window_ID, MQuery query) Open zoom window with querystatic void
startWorkflowProcess
(int AD_Table_ID, int Record_ID) Open Workflow Process Window for AD_Table_ID and Record_IDstatic String
toPdfJsUrl
(String pdfUrl) Construct url to open pdfUrl with embedded pdf.js viewer from Mozillastatic void
zoom
(int AD_Table_ID, int Record_ID) Zoom to AD Window by AD_Table_ID and Record_ID.static void
static void
Zoom to AD Window by AD_Table_ID and Record_ID.static void
static void
Zoom to AD window with the provided window id and filters according to the querystatic void
Zoom to AD Window with details from querystatic void
Zoom to AD Window by AD_Table_ID and Record_UU.static void
Zoom to AD Window by AD_Table_ID and Record_UU.
-
Field Details
-
LOCALE
Environment context attribute for Locale- See Also:
-
-
Constructor Details
-
AEnv
public AEnv()
-
-
Method Details
-
showCenterScreen
Show window in the center of screen.- Parameters:
window
- Window to position
-
showScreen
Show window at position (Window.setPosition(String)
) and show it.- Parameters:
window
- Window to positionposition
-
-
showCenterWindow
Show window in center of the parent window.- Parameters:
parent
- Parent Windowwindow
- Window to position
-
getMnemonic
Get Mnemonic character from text.- Parameters:
text
- text with '&'- Returns:
- Mnemonic character or 0
-
zoom
public static void zoom(int AD_Table_ID, int Record_ID) Zoom to AD Window by AD_Table_ID and Record_ID.- Parameters:
AD_Table_ID
-Record_ID
-
-
zoomUU
Zoom to AD Window by AD_Table_ID and Record_UU.- Parameters:
AD_Table_ID
-Record_UU
-
-
zoom
Zoom to AD Window by AD_Table_ID and Record_ID.- Parameters:
AD_Table_ID
-Record_ID
-query
- initial query for destination AD WindowwindowNo
-
-
zoomUU
Zoom to AD Window by AD_Table_ID and Record_UU.- Parameters:
AD_Table_ID
-Record_UU
-query
- initial query for destination AD WindowwindowNo
-
-
zoom
- Parameters:
AD_Table_ID
-Record_ID
-query
-
-
exit
Deprecated, for removal: This API element is subject to removal in a future version.Exit System.- Parameters:
status
- System exit status (usually 0 for no error)
-
logout
public static void logout()Logout AD_Session and clearwindowCache
. -
startWorkflowProcess
public static void startWorkflowProcess(int AD_Table_ID, int Record_ID) Open Workflow Process Window for AD_Table_ID and Record_ID- Parameters:
AD_Table_ID
-Record_ID
-
-
getMWindowVO
Get VO for AD_Window- Parameters:
WindowNo
- Window NoAD_Window_ID
- windowAD_Menu_ID
- menu- Returns:
GridWindowVO
instance for AD_Window_ID
-
postImmediate
public static String postImmediate(int WindowNo, int AD_Client_ID, int AD_Table_ID, int Record_ID, boolean force) Post Immediate.
CallDoc.manualPosting(int, int, int, int, boolean)
.- Parameters:
WindowNo
- windowAD_Table_ID
- Table ID of DocumentAD_Client_ID
- Client ID of DocumentRecord_ID
- Record ID of Documentforce
- force posting. if false, only post if (Processing='N' OR Processing IS NULL)- Returns:
- null if success, otherwise error
-
cacheReset
Cache Reset- Parameters:
tableName
- table nameRecord_ID
- record id
-
actionRefresh
Refresh lookup- Parameters:
lookup
-value
-mandatory
-shortList
-
-
actionZoom
Zoom to AD Window- Parameters:
lookup
- lookup for zoom destination tablevalue
- record key
-
actionDrill
Opens the Drill Assistant- Parameters:
data
- querywindowNo
-
-
actionDrill
Opens the Drill Assistant- Parameters:
data
- querywindowNo
-processID
- Source Report
-
showZoomWindow
Open zoom window with query- Parameters:
AD_Window_ID
-query
-
-
zoom
Zoom to AD window with the provided window id and filters according to the query- Parameters:
AD_Window_ID
- Window on which to zoomquery
- Filter to be applied on the records.
-
zoom
- Parameters:
AD_Window_ID
-query
-
-
showWindow
Show window in desktop. CallIDesktop.showWindow(Window)
.- Parameters:
win
-
-
zoom
Zoom to AD Window with details from query- Parameters:
query
- query
-
getImage
Get ImageIcon.- Parameters:
fileNameInImageDir
- full file name in imgaes folder (e.g. Bean16.png)- Returns:
- image
URI
-
isFirefox2
Deprecated.- Returns:
- true if client browser is firefox 2+
-
isBrowserSupported
Deprecated.See IDEMPIERE-1022- Returns:
- boolean
-
isInternetExplorer
Deprecated.- Returns:
- true if user agent is internet explorer
-
contains
public static boolean contains(org.zkoss.zk.ui.Component parent, org.zkoss.zk.ui.Component child) Is parent == child or parent is ancestor of child.- Parameters:
parent
-child
-- Returns:
- true if parent == child or parent is ancestor of child.
-
mergePdf
public static void mergePdf(List<File> pdfList, File outFile) throws IOException, com.lowagie.text.DocumentException, FileNotFoundException Merge pdfList to outFile- Parameters:
pdfList
-outFile
-- Throws:
IOException
com.lowagie.text.DocumentException
FileNotFoundException
-
getWindowHeader
Get window title- Parameters:
ctx
- contextWindowNo
- window- Returns:
- Header String
-
getLanguage
Get language of context- Parameters:
ctx
-- Returns:
Language
-
getLocale
Get locale of context- Parameters:
ctx
-- Returns:
Locale
-
getDialogHeader
Get title for dialog window- Parameters:
ctx
-windowNo
-prefix
-- Returns:
- dialog header
-
getDialogHeader
- Parameters:
ctx
-windowNo
-- Returns:
- dialog header
-
executeDesktopTask
Execute synchronous task in UI thread.
UseExecutions.activate(Desktop)
andExecutions.deactivate(Desktop)
pair if current thread is not UI/Listener thread.- Parameters:
runnable
-
-
executeAsyncDesktopTask
Execute asynchronous task in UI thread.- Parameters:
runnable
-
-
getDesktop
public static org.zkoss.zk.ui.Desktop getDesktop()Get current desktop.
Get from current executions (Executions.getCurrent()) if current thread is UI thread.
Otherwise, get fromDesktopRunnable.getThreadLocalDesktop()
.- Returns:
Desktop
-
isTablet
Deprecated, for removal: This API element is subject to removal in a future version.replace by ClientInfo.isMobile()- Returns:
- true if running on a tablet
-
getADWindowID
public static int getADWindowID(int windowNo) Get AD_Window_ID from windowNo.- Parameters:
windowNo
-- Returns:
- AD_Window_ID or
Env.adWindowDummyID
(if it is ProcessDialog of InfoWindow)
-
getListDocumentLanguage
Create WTableDirEditor for language with IsLoginLocale=Y.- Parameters:
client
-- Returns:
WTableDirEditor
for Language if client is with IsMultiLingualDocument=Y- Throws:
Exception
-
getApplicationUrl
- Returns:
- URL to access application from browser
-
getZoomUrlTableUU
Get link for direct access to the record using AD_Table_ID+Record_UUID- Parameters:
po
-- Returns:
- URL link for direct access to the record using AD_Table_ID+Record_UUID
-
getZoomUrlTableID
Get link for direct access to the record using AD_Table_ID+Record_ID- Parameters:
po
-- Returns:
- URL link for direct access to the record using AD_Table_ID+Record_ID
-
getZoomUrlTableName
Get link for direct access to the record using TableName+Record_ID- Parameters:
po
-- Returns:
- URL link for direct access to the record using TableName+Record_ID
-
getOrSetExecutionAttribute
Set attribute value to Boolean.TRUE if attribute doesn't exists in current execution yet.- Parameters:
attribute
-- Returns:
- true if attribute have been set for current executions
-
detachInputElement
public static void detachInputElement(org.zkoss.zk.ui.Component parent) Workaround for detached HTML input element leak.
Detach all InputElement and Button that's the immediate or not immediate child of parent.
Note that to remedy the detached HTML element leak issue, we must defer the detach of parent withExecutions.schedule(Desktop, EventListener, Event)
.- Parameters:
parent
-Component
-
toPdfJsUrl
Construct url to open pdfUrl with embedded pdf.js viewer from Mozilla- Parameters:
pdfUrl
-- Returns:
- pdf.js viewer url
-