Class GridController

  • All Implemented Interfaces:
    MouseListener, ImageObserver, MenuContainer, PropertyChangeListener, VetoableChangeListener, Serializable, EventListener, Accessible, ListSelectionListener, DataStatusListener, Evaluatee

    public class GridController
    extends CPanel
    implements DataStatusListener, ListSelectionListener, Evaluatee, VetoableChangeListener, PropertyChangeListener, MouseListener
    The Grid Controller is the panel for single and multi-row presentation and links to the Model Tab.
      UI Structure:
      this    (BorderLayout)
          splitPane (JSplitPane)
              left
                  graphicPanel
              right
                  cardPanel   JPanel  (CardLayout)
                      srPane  JSplitPane
                                                    vPane   JScrollPane
                            vPanel  VPanel (GridBagLayout)
                                                    vIncludedGC     GridController
                      mrPane  JScrollPane
                          vTable  VTable
    
      DataBinding:
      - MultiRow - is automatic between VTable and MTable
      - SingleRow
                    - from VEditors via fireVetoableChange(m_columnName, null, getText());
                            (vetoableChange)
                    - to VEditors via updateSingleRow -> Editor.setValue(object)
    
      Event Chains
      -- Navigation --
      (VTable selection -> GridController.valueChanged)
      (APanel selection)
          + MTab.navivate
              + MTab.setCurrentRow
                  + Update all MFields
                      + MField.setValue
                          + setContext
                          + fire PropertyChange "Value"
                              + VEditor.propertyChange
                                  + VEditor.setValue
                  + MTab.fireProperyChange "CurrentRow"
                      + VTable.propertyChange (setRowSelectionInterval)
                          + GridController.valueChange
                              + GridController.dynamicDisplay(complete)
                  + MTab.fireDataStatusChanged
                      + APanel.statusChanged
    
      -- ValueChanges --
      VEditor.fireVetoableChange
          + (VCellEditor.vetoableChange/getCellEditorValue)   -- multi-row source
          + (GridController.vetoableChange)                   -- single-row source
              + MTable.setValueAt
                  + MField.setValue
                      + setContext
                      + fire PropertyChange "Value"
                          + VEditor.setValue
                  + MTable.fireDataStatusChanged
                      + MTab.dataStatusChanged
                          + MTab.fireDataStatusChanged
                              + APanel.statusChanged
                      + GridController.dataStatusChanged
                          + GridController.dynamicDisplay(selective)
      
    Version:
    $Id: GridController.java,v 1.8 2006/09/25 00:59:52 jjanke Exp $
    Author:
    Jorg Janke, Teo Sarca - BF [ 1742159 ], BF [ 1707876 ]
    See Also:
    Serialized Form
    • Constructor Detail

      • GridController

        public GridController()
        Constructor - you need to call initGrid for instanciation
    • Method Detail

      • toString

        public String toString()
        toString
        Overrides:
        toString in class CPanel
        Returns:
        string representation
      • dispose

        public void dispose()
        Displose
      • initGrid

        public boolean initGrid​(GridTab mTab,
                                boolean onlyMultiRow,
                                int WindowNo,
                                APanel aPanel,
                                GridWindow mWindow)
      • initGrid

        public boolean initGrid​(GridTab mTab,
                                boolean onlyMultiRow,
                                int WindowNo,
                                APanel aPanel,
                                GridWindow mWindow,
                                boolean lazy)
        Init Grid.
          - Map table to model
          - Update (multi-row) table info with renderers/editors
          - build single-row panel
          - initialize display
          
        Parameters:
        mTab - tab
        onlyMultiRow - only table
        WindowNo - window no
        aPanel - optional Application Panel for adding button listeners
        mWindow - parent Window Model
        Returns:
        true if initialized
      • isInit

        public boolean isInit()
        Returns:
        boolean
      • includeTab

        public boolean includeTab​(GridController gc,
                                  APanel aPanel,
                                  GridSynchronizer sync)
        Include Tab
        Parameters:
        gc - grid controller to add
        Returns:
        GridSynchronizer
      • setDetailGrid

        public void setDetailGrid​(boolean value)
      • isDetailGrid

        public boolean isDetailGrid()
      • getTitle

        public String getTitle()
        Get Title
        Returns:
        title
      • activate

        public void activate()
        Activate Grid Controller. Called by APanel when GridController is displayed (foreground)
      • registerESCAction

        public void registerESCAction​(AppsAction aIgnore)
        Register ESC Actions - overwrite VTable's Keystrokes assignment for ESC
        Parameters:
        aIgnore - ignore
      • query

        public void query​(boolean onlyCurrentRows,
                          int onlyCurrentDays,
                          int maxRows)
        Query Tab and resize Table (called from APanel)
        Parameters:
        onlyCurrentRows - only current rows
        onlyCurrentDays - how many days back
        maxRows - maximim rows or 0 for all
      • switchRowPresentation

        public void switchRowPresentation()
        Switch from single to multi & vice versa
      • switchSingleRow

        public void switchSingleRow()
        Switch to SingleRow Presentation
      • switchMultiRow

        public void switchMultiRow()
        Switch to MultiRow Presentation
      • isSingleRow

        public boolean isSingleRow()
        Is Single Row presentation
        Returns:
        true if Single Row is displayed
      • removeDataStatusListener

        public void removeDataStatusListener​(DataStatusListener l)
        Remove Listener - pass on to MTab
        Parameters:
        l - listener
      • addDataStatusListener

        public void addDataStatusListener​(DataStatusListener l)
        Add Data Status Listener - pass on to MTab
        Parameters:
        l - listener
      • dataStatusChanged

        public void dataStatusChanged​(DataStatusEvent e)
        Data Status Listener - for MTab events.

        Callouts are processed here for GUI changes - same as in MTab.setValue for batch changes

        calls dynamicDisplay

        Specified by:
        dataStatusChanged in interface DataStatusListener
        Parameters:
        e - event
      • dynamicDisplay

        public void dynamicDisplay​(int col)
        Dynamic Display. - Single Row Screen layout and update of dynamic Lookups

        Single Row layout: the components's name is the ColumnName; if it matches, the MField.isDisplayed(true) is used to determine if it is visible if the component is a VEditor, setEnabled is set from the MField

        Multi Row layout is not changed: VCellRenderer calls JTable.isCellEditable -> checks MField.isEditable (Active, isDisplayed) VCellEditor.isCellEditable calls MField.isEditable(true)
        If a column is not displayed, the width is set to 0 in dynInit

        Dynamic update of data is handeled in VLookup.focusGained/Lost. When focus is gained the model is temporarily updated with the specific validated data, if lost, it is switched back to the unvalidated data (i.e. everything). This allows that the display methods have a lookup to display.
        Here: if the changed field has dependents and the dependent is a Lookup and this lookup has a dynamic dependence of the changed field, the value of that field is set to null (in MTab.processDependencies - otherwise it would show an invalid value). As Editors listen for value changed of their MField, the display is updated.

        Called from GridController.valueChanged/dataStatusChanged, APane;.stateChanged/unlock/cmd_...

        Parameters:
        col - selective column number or 0 if all
      • rowChanged

        public void rowChanged​(boolean save,
                               int keyID)
        Row Changed - synchronize with Tree
        Parameters:
        save - true the row was saved (changed/added), false if the row was deleted
        keyID - the ID of the row changed
      • saveMultipleRecords

        protected void saveMultipleRecords​(Properties ctx,
                                           String tableName,
                                           String columnName,
                                           int recordId,
                                           Integer[] values,
                                           String trxName)
                                    throws Exception
        Save Multiple records - Clone a record and assign new values to each clone for a specific column.
        Parameters:
        ctx - context
        tableName - Table Name
        columnName - Column for which value need to be changed
        recordId - Record to clone
        values - Values to be assigned to clones for the specified column
        trxName - Transaction
        Throws:
        Exception - If error is occured when loading the PO or saving clones
      • getMTab

        public GridTab getMTab()
        Get Model Tab
        Returns:
        Model Tab
      • getDisplayLogic

        public String getDisplayLogic()
        Get Display Logic
        Returns:
        Display Logic
      • getTable

        public VTable getTable()
        Get VTable
        Returns:
        VTable
      • setMnemonics

        public void setMnemonics​(boolean set)
        Set Window level Mnemonics
        Parameters:
        set - true if set otherwise unregiser
      • stopEditor

        public void stopEditor​(boolean saveValue)
        Stop Table & SR Editors and move focus to graphPanel
        Parameters:
        saveValue - save value
      • get_ValueAsString

        public String get_ValueAsString​(String variableName)
        Get Variable Value
        Specified by:
        get_ValueAsString in interface Evaluatee
        Parameters:
        variableName - name
        Returns:
        value
      • isCurrent

        public boolean isCurrent()
        Is controller data not stale
        Returns:
        boolean
      • getvPanel

        public VPanel getvPanel()
      • refreshMTab

        public void refreshMTab​(GridController includedTab)
      • acceptEditorChanges

        public void acceptEditorChanges()
        Accept pending editor changes.