Class AEnv

java.lang.Object
org.adempiere.webui.apps.AEnv

public final class AEnv extends Object
Static application environment and utilities methods.
Author:
Jorg Janke Colin Rooney (croo) and kstan_79 RFE#1670185
  • Field Details

  • Constructor Details

    • AEnv

      public AEnv()
  • Method Details

    • showCenterScreen

      public static void showCenterScreen(Window window)
      Show window in the center of screen.
      Parameters:
      window - Window to position
    • showScreen

      public static void showScreen(Window window, String position)
      Show window at position (Window.setPosition(String)) and show it.
      Parameters:
      window - Window to position
      position -
    • showCenterWindow

      public static void showCenterWindow(Window parent, Window window)
      Show window in center of the parent window.
      Parameters:
      parent - Parent Window
      window - Window to position
    • getMnemonic

      public static char getMnemonic(String text)
      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

      public static void zoomUU(int AD_Table_ID, String Record_UU)
      Zoom to AD Window by AD_Table_ID and Record_UU.
      Parameters:
      AD_Table_ID -
      Record_UU -
    • zoom

      public static void zoom(int AD_Table_ID, int Record_ID, MQuery query, int windowNo)
      Zoom to AD Window by AD_Table_ID and Record_ID.
      Parameters:
      AD_Table_ID -
      Record_ID -
      query - initial query for destination AD Window
      windowNo -
    • zoomUU

      public static void zoomUU(int AD_Table_ID, String Record_UU, MQuery query, int windowNo)
      Zoom to AD Window by AD_Table_ID and Record_UU.
      Parameters:
      AD_Table_ID -
      Record_UU -
      query - initial query for destination AD Window
      windowNo -
    • zoom

      public static void zoom(int AD_Table_ID, int Record_ID, MQuery query)
      Parameters:
      AD_Table_ID -
      Record_ID -
      query -
    • exit

      @Deprecated(forRemoval=true, since="11") public static void exit(int status)
      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 clear windowCache.
    • 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

      public static GridWindowVO getMWindowVO(int WindowNo, int AD_Window_ID, int AD_Menu_ID)
      Get VO for AD_Window
      Parameters:
      WindowNo - Window No
      AD_Window_ID - window
      AD_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)
      Parameters:
      WindowNo - window
      AD_Table_ID - Table ID of Document
      AD_Client_ID - Client ID of Document
      Record_ID - Record ID of Document
      force - force posting. if false, only post if (Processing='N' OR Processing IS NULL)
      Returns:
      null if success, otherwise error
    • cacheReset

      public static void cacheReset(String tableName, int Record_ID)
      Cache Reset
      Parameters:
      tableName - table name
      Record_ID - record id
    • actionRefresh

      public static void actionRefresh(Lookup lookup, Object value, boolean mandatory, boolean shortList)
      Refresh lookup
      Parameters:
      lookup -
      value -
      mandatory -
      shortList -
    • actionZoom

      public static void actionZoom(Lookup lookup, Object value)
      Zoom to AD Window
      Parameters:
      lookup - lookup for zoom destination table
      value - record key
    • actionDrill

      public static void actionDrill(DrillEvent.DrillData data, int windowNo)
      Opens the Drill Assistant
      Parameters:
      data - query
      windowNo -
    • actionDrill

      public static void actionDrill(DrillEvent.DrillData data, int windowNo, int processID)
      Opens the Drill Assistant
      Parameters:
      data - query
      windowNo -
      processID - Source Report
    • showZoomWindow

      public static void showZoomWindow(int AD_Window_ID, MQuery query)
      Open zoom window with query
      Parameters:
      AD_Window_ID -
      query -
    • zoom

      public static void zoom(int AD_Window_ID, MQuery query, int windowNo)
      Zoom to AD window with the provided window id and filters according to the query
      Parameters:
      AD_Window_ID - Window on which to zoom
      query - Filter to be applied on the records.
    • zoom

      public static void zoom(int AD_Window_ID, MQuery query)
      Parameters:
      AD_Window_ID -
      query -
    • showWindow

      public static void showWindow(Window win)
      Show window in desktop. Call IDesktop.showWindow(Window).
      Parameters:
      win -
    • zoom

      public static void zoom(MQuery query)
      Zoom to AD Window with details from query
      Parameters:
      query - query
    • getImage

      public static URI getImage(String fileNameInImageDir)
      Get ImageIcon.
      Parameters:
      fileNameInImageDir - full file name in imgaes folder (e.g. Bean16.png)
      Returns:
      image URI
    • isFirefox2

      @Deprecated public static boolean isFirefox2()
      Deprecated.
      Returns:
      true if client browser is firefox 2+
    • isBrowserSupported

      @Deprecated public static boolean isBrowserSupported()
      Deprecated.
      See IDEMPIERE-1022
      Returns:
      boolean
    • isInternetExplorer

      @Deprecated public static 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

      public static String getWindowHeader(Properties ctx, int WindowNo)
      Get window title
      Parameters:
      ctx - context
      WindowNo - window
      Returns:
      Header String
    • getLanguage

      public static Language getLanguage(Properties ctx)
      Get language of context
      Parameters:
      ctx -
      Returns:
      Language
    • getLocale

      public static Locale getLocale(Properties ctx)
      Get locale of context
      Parameters:
      ctx -
      Returns:
      Locale
    • getDialogHeader

      public static String getDialogHeader(Properties ctx, int windowNo, String prefix)
      Get title for dialog window
      Parameters:
      ctx -
      windowNo -
      prefix -
      Returns:
      dialog header
    • getDialogHeader

      public static String getDialogHeader(Properties ctx, int windowNo)
      Parameters:
      ctx -
      windowNo -
      Returns:
      dialog header
    • executeDesktopTask

      public static void executeDesktopTask(Runnable runnable)
      Execute synchronous task in UI thread.
      Use Executions.activate(Desktop) and Executions.deactivate(Desktop) pair if current thread is not UI/Listener thread.
      Parameters:
      runnable -
    • executeAsyncDesktopTask

      public static void executeAsyncDesktopTask(Runnable runnable)
      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 from DesktopRunnable.getThreadLocalDesktop().
      Returns:
      Desktop
    • isTablet

      @Deprecated(forRemoval=true, since="11") public static boolean 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

      public static WTableDirEditor getListDocumentLanguage(MClient client) throws Exception
      Create WTableDirEditor for language with IsLoginLocale=Y.
      Parameters:
      client -
      Returns:
      WTableDirEditor for Language if client is with IsMultiLingualDocument=Y
      Throws:
      Exception
    • getApplicationUrl

      public static String getApplicationUrl()
      Returns:
      URL to access application from browser
    • getZoomUrlTableUU

      public static String getZoomUrlTableUU(PO po)
      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

      public static String getZoomUrlTableID(PO po)
      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

      public static String getZoomUrlTableName(PO po)
      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

      public static boolean getOrSetExecutionAttribute(String attribute)
      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 with Executions.schedule(Desktop, EventListener, Event).
      Parameters:
      parent - Component
    • toPdfJsUrl

      public static String toPdfJsUrl(String pdfUrl)
      Construct url to open pdfUrl with embedded pdf.js viewer from Mozilla
      Parameters:
      pdfUrl -
      Returns:
      pdf.js viewer url