Class InfoWindow

java.lang.Object
org.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.HtmlBasedComponent
org.zkoss.zul.impl.XulElement
org.zkoss.zul.Window
All Implemented Interfaces:
Serializable, Cloneable, ValueChangeListener, WTableModelListener, ISupportMask, IHelpContext, org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event>, org.zkoss.zk.ui.ext.Scope, org.zkoss.zk.ui.IdSpace, org.zkoss.zk.ui.sys.ComponentCtrl, org.zkoss.zul.ext.Framable, org.zkoss.zul.ext.Sortable<Object>
Direct Known Subclasses:
InfoAssetWindow, InfoAssignmentWindow, InfoBPartnerWindow, InfoInOutWindow, InfoInvoiceWindow, InfoOrderWindow, InfoPAttributeInstanceWindow, InfoPAttributeWindow, InfoPaymentWindow, InfoProductWindow

public class InfoWindow extends InfoPanel implements ValueChangeListener, org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event>
AD_InfoWindow implementation
Author:
hengsin
See Also:
  • Field Details

  • Constructor Details

    • InfoWindow

      public InfoWindow(int WindowNo, String tableName, String keyColumn, String queryValue, boolean multipleSelection, String whereClause, int AD_InfoWindow_ID)
      Parameters:
      WindowNo -
      tableName -
      keyColumn -
      queryValue -
      multipleSelection -
      whereClause -
      AD_InfoWindow_ID -
    • InfoWindow

      public InfoWindow(int WindowNo, String tableName, String keyColumn, String queryValue, boolean multipleSelection, String whereClause, int AD_InfoWindow_ID, boolean lookup)
      Parameters:
      WindowNo -
      tableName -
      keyColumn -
      queryValue -
      multipleSelection -
      whereClause -
      AD_InfoWindow_ID -
      lookup -
    • InfoWindow

      public InfoWindow(int WindowNo, String tableName, String keyColumn, String queryValue, boolean multipleSelection, String whereClause, int AD_InfoWindow_ID, boolean lookup, GridField field)
      Parameters:
      WindowNo -
      tableName -
      keyColumn -
      queryValue -
      multipleSelection -
      whereClause -
      AD_InfoWindow_ID -
      lookup -
      field -
    • InfoWindow

      public InfoWindow(int WindowNo, String tableName, String keyColumn, String queryValue, boolean multipleSelection, String whereClause, int AD_InfoWindow_ID, boolean lookup, GridField field, String predefinedContextVariables)
      Parameters:
      WindowNo -
      tableName -
      keyColumn -
      queryValue -
      multipleSelection -
      whereClause -
      AD_InfoWindow_ID -
      lookup -
      field -
      predefinedContextVariables -
    • InfoWindow

      public InfoWindow(int WindowNo, String tableName, String keyColumn, String queryValue, boolean multipleSelection, String whereClause, int AD_InfoWindow_ID, boolean lookup, GridField field, String predefinedContextVariables, Lookup lookupModel)
      Parameters:
      WindowNo -
      tableName -
      keyColumn -
      queryValue -
      multipleSelection -
      whereClause -
      AD_InfoWindow_ID -
      lookup -
      field -
      predefinedContextVariables -
      lookupModel -
  • Method Details

    • focusToFirstEditor

      public void focusToFirstEditor()
      set focus to first parameter editor
    • updateSubcontent

      protected void updateSubcontent(int row)
      Update related info for a specific row. If targetRow < 0, update using selected row.
      Overrides:
      updateSubcontent in class InfoPanel
    • initInfoProcess

      protected void initInfoProcess()
      IDEMPIERE-1334
      Load info processes by layout type.
      Create buttons, drop down list and popup menu.
      Set status of haveProcess flag.
    • bindInfoProcess

      protected void bindInfoProcess()
      Evaluate display logic of processes. Implemented by sub class.
      Overrides:
      bindInfoProcess in class InfoPanel
    • bindInfoProcessBt

      protected void bindInfoProcessBt()
      Evaluate display logic of process info button and set visibility of button.
    • bindInfoProcessDropDown

      protected void bindInfoProcessDropDown()
      Create drop down list (Combobox) of process
    • bindInfoProcessMenu

      protected void bindInfoProcessMenu()
      Create popup of menu for processes
    • moveProcessButtonsToBeforeRight

      public void moveProcessButtonsToBeforeRight()
      Move process buttons from left of centre panel to the front of right panel
    • processQueryValue

      protected void processQueryValue()
      Process query value from input element
    • testQueryForAutoComplete

      protected void testQueryForAutoComplete()
    • testQueryForEachIdentifier

      protected void testQueryForEachIdentifier()
    • testQueryForSplit

      protected void testQueryForSplit(String[] values)
    • loadInfoWindowData

      protected void loadInfoWindowData()
      Description copied from class: InfoPanel
      query ADInfoWindow from ADInfoWindowID
      Overrides:
      loadInfoWindowData in class InfoPanel
    • loadInfoDefinition

      protected boolean loadInfoDefinition()
      load info window definition
      Returns:
      true if loaded ok
    • loadInfoRelatedTabs

      protected boolean loadInfoRelatedTabs()
      load related info
      Returns:
      true if loaded ok
    • prepareTable

      protected void prepareTable()
      Setup list box and construct SQL query clause
    • createLookupColumnInfo

      protected ColumnInfo createLookupColumnInfo(AccessSqlParser.TableInfo[] tableInfos, GridField gridField, InfoColumnVO infoColumn)
      Parameters:
      tableInfos -
      gridField -
      infoColumn -
      Returns:
      ColumnInfo
    • getSQLWhere

      protected String getSQLWhere()
      Description copied from class: InfoPanel
      Get dynamic WHERE part of SQL.
      When override this method, please take isQueryByUser and prevWhereClause into consideration.
      Specified by:
      getSQLWhere in class InfoPanel
      Returns:
      WHERE clause
    • findInfoColumn

      protected InfoColumnVO findInfoColumn(GridField gridField)
      Parameters:
      gridField -
      Returns:
      InfoColumnVO if found, null otherwise
    • findInfoColumnParameter

      protected InfoColumnVO findInfoColumnParameter(GridField gridField)
      Parameters:
      gridField -
      Returns:
      InfoColumnVO if found, null otherwise
    • isParameteChangeValue

      protected boolean isParameteChangeValue()
      Check if parameter value has change
      Returns:
      true if at least one parameter value has change or this is the first search by user
    • setParameters

      protected void setParameters(PreparedStatement pstmt, boolean forCount) throws SQLException
      Description copied from class: InfoPanel
      Set Parameters for Query.
      When override this method, please take isQueryByUser and prevWhereClause into consideration.
      Specified by:
      setParameters in class InfoPanel
      Parameters:
      pstmt - statement
      forCount - for counting records
      Throws:
      SQLException
    • setParameter

      protected int setParameter(WEditor editor, InfoColumnVO infoColumnVO, PreparedStatement pstmt, int parameterIndex) throws SQLException
      Parameters:
      editor -
      infoColumnVO -
      pstmt -
      parameterIndex - current parameter index
      Returns:
      current parameter index
      Throws:
      SQLException
    • setParameter

      protected void setParameter(PreparedStatement pstmt, int parameterIndex, Object value, String queryOperator) throws SQLException
      Set parameters for prepared statement.
      Does not need null check for value.
      Parameters:
      pstmt -
      parameterIndex -
      value -
      queryOperator -
      Throws:
      SQLException
    • prepareTable

      protected void prepareTable(ColumnInfo[] layout, String from, String where, String orderBy)
      Description copied from class: InfoPanel
      set up list box and construct sql clause
      Overrides:
      prepareTable in class InfoPanel
    • addViewIDToQuery

      protected void addViewIDToQuery()
      Add all ViewID in each MInfoProcess to query.
      If main query have subquery in SELECT, it will beak or incorrect
    • addKeyViewToQuery

      protected void addKeyViewToQuery()
      If InfoPanel.keyColumnOfView not null and not display, add InfoPanel.keyColumnOfView to query
    • isNeedAppendKeyViewData

      public boolean isNeedAppendKeyViewData()
      Description copied from class: InfoPanel
      need override at infoWindow to check isDisplay
      Overrides:
      isNeedAppendKeyViewData in class InfoPanel
      Returns:
      true if need to append InfoPanel.keyColumnOfView to InfoPanel.columnDataIndex
    • addMoreColumnToQuery

      protected String addMoreColumnToQuery(String sqlMain, IInfoColumn[] listInfoColumn)
      Info window load infoColumns with isDisplay = true to construct the main query.
      Some function uses data from hidden column as viewID in infoProcess or as parentLink of infoRelateWindow. This function is use to append the hidden column to main query.

      Append info window column to query.

      Parameters:
      sqlMain - main SQL to append column
      listInfoColumn - list of info column to add to query
      Returns:
      SQL after append column
    • renderWindow

      protected void renderWindow()
      layout window UI elements
    • renderFooter

      protected void renderFooter(org.zkoss.zul.South south)
      layout footer
      Parameters:
      south -
    • insertPagingComponent

      protected void insertPagingComponent()
      Description copied from class: InfoPanel
      add paging component for list box
      Overrides:
      insertPagingComponent in class InfoPanel
    • renderContentPane

      protected void renderContentPane(org.zkoss.zul.Center center)
      layout center content pane
      Parameters:
      center -
    • renderParameterPane

      protected void renderParameterPane(org.zkoss.zul.North north)
      layout query parameter pane
      Parameters:
      north -
    • createParameterPanel

      protected void createParameterPanel()
      create query parameter panel
    • layoutParameterGrid

      protected void layoutParameterGrid(boolean update)
      layout query parameter panel
      Parameters:
      update -
    • evalDisplayLogic

      protected void evalDisplayLogic()
      evaluate display logic for input parameters
    • addSelectionColumn

      protected void addSelectionColumn(InfoColumnVO infoColumn, GridField mField, GridField mField2)
      Add Selection Column to first Tab
      Parameters:
      infoColumn -
      mField - field
    • addSearchParameter

      protected void addSearchParameter(WEditor editor, WEditor editor2)
      add search parameter
      Parameters:
      editor -
      editor2 -
    • getNoOfParameterColumns

      protected int getNoOfParameterColumns()
      Returns:
      number of columns for parameter grid
    • createAndCheckbox

      protected void createAndCheckbox()
      create checkbox for AND
    • findColumnIndex

      protected int findColumnIndex(String columnName)
      Parameters:
      columnName -
      Returns:
      column index, -1 if not found
    • saveSelectionDetail

      protected void saveSelectionDetail()
      Save Selection Details Get Location/Partner Info
      Overrides:
      saveSelectionDetail in class InfoPanel
    • buildDataSQL

      protected String buildDataSQL(int start, int end)
      Description copied from class: InfoPanel
      build sql clause with paging
      Overrides:
      buildDataSQL in class InfoPanel
      Returns:
      sql clause
    • executeQuery

      protected void executeQuery()
      Description copied from class: InfoPanel
      Execute Query
      Overrides:
      executeQuery in class InfoPanel
    • hasZoom

      protected boolean hasZoom()
      Description copied from class: InfoPanel
      Has Zoom support (default false)
      Overrides:
      hasZoom in class InfoPanel
      Returns:
      true if it has zoom support (default false)
    • valueChange

      public void valueChange(ValueChangeEvent evt)
      Specified by:
      valueChange in interface ValueChangeListener
    • postQueryAfterChangeEvent

      protected void postQueryAfterChangeEvent()
      Post query event if all editor with IsQueryAfterChange=True have been populated
    • dynamicDisplay

      protected void dynamicDisplay(WEditor editor)
      Parameters:
      editor -
    • onEvent

      public void onEvent(org.zkoss.zk.ui.event.Event event)
      Specified by:
      onEvent in interface org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event>
      Overrides:
      onEvent in class InfoPanel
    • resetParameters

      protected void resetParameters()
      Overrides:
      resetParameters in class InfoPanel
    • resetParameters

      protected void resetParameters(WEditor editor)
      Parameters:
      editor -
    • onPageAttached

      public void onPageAttached(org.zkoss.zk.ui.Page newpage, org.zkoss.zk.ui.Page oldpage)
      Specified by:
      onPageAttached in interface org.zkoss.zk.ui.sys.ComponentCtrl
      Overrides:
      onPageAttached in class InfoPanel
    • onClientInfo

      protected void onClientInfo()
      handle on client info event
    • testCount

      protected boolean testCount()
      Test Row Count
      Overrides:
      testCount in class InfoPanel
      Returns:
      true if display
    • testCount

      protected boolean testCount(boolean promptError)
      Test Row Count
      Returns:
      true if display
    • hasIsActiveEditor

      protected boolean hasIsActiveEditor()
      Returns:
      true if there is an 'IsActive' criteria
    • getInfoColumnslayout

      public ArrayList<ColumnInfo> getInfoColumnslayout(MInfoWindow info)
      author xolali IDEMPIERE-1045 getInfoColumnslayout(MInfoWindow info)
      Parameters:
      info -
      Returns:
      list of ColumnInfo
    • reset

      protected void reset(EmbedWinInfo relatedInfo)
      reset to empty
      Parameters:
      relatedInfo -
    • getGridField

      protected GridField getGridField(InfoColumnVO infoColumn)
      author xolali IDEMPIERE-1045 GridField getGridField(InfoColumnVO infoColumn)
      Parameters:
      infoColumn -
      Returns:
      GridField
    • validateParameters

      public boolean validateParameters()
      validate parameter before run query eval input value of mandatory field, if null show field in red color
      Overrides:
      validateParameters in class InfoPanel
      Returns:
      true if parameters pass validation
    • validateField

      protected boolean validateField(WEditor wEditor)
      Validate mandatory fields.
      Display red color when a mandatory field is not fill.
      Parameters:
      wEditor -
      Returns:
      true if pass mandatory validation, false otherwise
    • hasNew

      protected boolean hasNew()
      Description copied from class: InfoPanel
      Support create new record (default false)
      Overrides:
      hasNew in class InfoPanel
      Returns:
      true if support create new record
    • getADWindowID

      protected int getADWindowID()
      Get id of window link with main table of this info window
      Returns:
      AD_Window_ID
    • newRecordAction

      protected void newRecordAction()
      Description copied from class: InfoPanel
      Handle user click on new record button.
      Overrides:
      newRecordAction in class InfoPanel
    • setSouthVisible

      protected void setSouthVisible(boolean visible)
      Allow to show or hide the sub panel (detail) programmatically
      Parameters:
      visible -
    • getRowaAsCtx

      public Properties getRowaAsCtx(int row, int editingColumn, Object editingValue)
      Parameters:
      row -
      editingColumn -
      editingValue -
      Returns:
      Properties
    • onCellEditCallback

      public void onCellEditCallback(ValueChangeEvent event, int rowIndex, int colIndex, WEditor editor, GridField field)
      Parameters:
      event -
      rowIndex -
      colIndex -
      editor -
      field -
    • restoreOriginalValues

      protected void restoreOriginalValues(int rowIndex)
      Parameters:
      rowIndex -
    • cacheOriginalValues

      protected void cacheOriginalValues(int rowIndex)
      Parameters:
      rowIndex -
    • tableChanged

      public void tableChanged(WTableModelEvent event)
      Description copied from interface: WTableModelListener
      Notify listeners the exact range of cells, rows, or columns that have changed.
      Specified by:
      tableChanged in interface WTableModelListener
      Overrides:
      tableChanged in class InfoPanel
      Parameters:
      event - table model event
    • onQueryCallback

      public void onQueryCallback(org.zkoss.zk.ui.event.Event event)
      Description copied from class: InfoPanel
      handle echo from query event
      Overrides:
      onQueryCallback in class InfoPanel
      Parameters:
      event - null to indicate reset instead of echo from query event
    • updateListSelected

      protected void updateListSelected()
      Description copied from class: InfoPanel
      Get all selected record of current page and update to InfoPanel.recordSelectedData.
      Remove unselected record and add new selected record.
      We maintain value of key, and extra value append by InfoPanel.appendInfoColumnData(ResultSet, List, IInfoColumn[], List)
      Overrides:
      updateListSelected in class InfoPanel
    • restoreSelectedInPage

      protected void restoreSelectedInPage()
      Description copied from class: InfoPanel
      go through all data record, in case key value is in InfoPanel.recordSelectedData, mark it as selected record
      Overrides:
      restoreSelectedInPage in class InfoPanel
    • onRestoreSelectedItemIndexInPage

      public boolean onRestoreSelectedItemIndexInPage(Object keyViewValue, int rowIndex, Object oRow)
      Description copied from class: InfoPanel
      Hook to intercept 'restore selection' actions
      Overrides:
      onRestoreSelectedItemIndexInPage in class InfoPanel
      Parameters:
      keyViewValue - row view key
      rowIndex - row index
      oRow - row
      Returns:
      false to skip restore selection
    • initExport

      protected void initExport()
      init export button
    • enableExportButton

      protected void enableExportButton()
      enable/disable export button
    • getEditor

      public WEditor getEditor(String columnName)
      Return (if exists) the editor with the name
      Parameters:
      columnName -
      Returns:
      editor
    • getColumnIndex

      public int getColumnIndex(String columnName)
      Return (if exists) the index of the column in the grid
      Parameters:
      columnName -
      Returns:
      index of the column