org.opensubsystems.inventory.application.swt
Class CategorizedItemsTable

java.lang.Object
  extended by org.eclipse.swt.widgets.Widget
      extended by org.eclipse.swt.widgets.Control
          extended by org.eclipse.swt.widgets.Scrollable
              extended by org.eclipse.swt.widgets.Composite
                  extended by org.opensubsystems.inventory.application.swt.CategorizedItemsTable
All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable, org.opensubsystems.patterns.listdata.util.AsyncDataLoaderOwner
Direct Known Subclasses:
ItemTable

public abstract class CategorizedItemsTable
extends org.eclipse.swt.widgets.Composite
implements org.opensubsystems.patterns.listdata.util.AsyncDataLoaderOwner

Table displaying list of some items which can be filtered using categories.

Version:
$Id: CategorizedItemsTable.java,v 1.12 2007/01/07 06:14:07 bastafidli Exp $
Author:
Miro Halas
Code reviewer:
Miro Halas
Code reviewed:
1.10 2006/04/05 05:17:10 bastafidli

Field Summary
static int DISPLAY_INVENTORY
          Show item types in inventory.
static int DISPLAY_ISSUED
          Show item types with issued information.
static int DISPLAY_ISSUED_WITHOUT_FILTERS
          Show item types with issued information.
static int DISPLAY_UNKNOVN
          Constant for showed data type.
static java.lang.String[] FIND_BUTTONS
          Constant for Find buttons in char pad.
protected  org.eclipse.swt.widgets.Button m_allItemsButton
          Button to show all (not only shipped) items.
protected  org.eclipse.swt.widgets.Button m_allMainCategories
          Button to display all main categories.
protected  org.eclipse.swt.widgets.Button m_allSubCategories
          Button to display all subcategories for some main category.
protected  org.eclipse.swt.widgets.Button[] m_arMainCategoryButtons
          Row of buttons displaying main category items.
protected  org.eclipse.swt.widgets.Button[] m_arSubCategoryButtons
          Row of buttons displaying subcategory items.
protected  org.eclipse.swt.widgets.Composite m_categoryRow
          Control which contains buttons for main categories.
protected  Inventory m_defaultInventory
          Inventory which is used to load items from.
protected  int m_displayedDataType
          What data are displayed in table
protected  org.eclipse.swt.widgets.Button m_extraFiltersButton
          The most right button with from the series of filter buttons.
protected  org.eclipse.swt.widgets.Button m_findItemsButton
          Button to show CharacterPad dialog for find function
protected  org.eclipse.swt.widgets.Button m_issuedItemsButton
          Button to show only shipped items.
protected  java.lang.String m_likeText
          Like part of sql from CharacterPad
protected  org.opensubsystems.patterns.listdata.util.AsyncDataLoader m_loader
          The last started loader.
protected  org.opensubsystems.patterns.listdata.data.ListOptions m_mainCategoryOptions
          Option data for the list of main categories.
protected  org.eclipse.swt.widgets.Button m_missingItemsButton
          Button to show missing items - that which the user didn't return on time
protected  org.opensubsystems.core.application.ThickClientModule m_module
          Module displaying this table.
protected  org.eclipse.swt.widgets.Button m_nextMainCategories
          Button to display next main categories.
protected  org.eclipse.swt.widgets.Button m_nextSubCategories
          Button to display next subcategories.
protected  org.eclipse.swt.widgets.Button m_permanentItemsButton
          Button to show permanent items
protected  java.lang.Integer[] m_permFilterState
          Current permanent button state
protected  org.eclipse.swt.widgets.Button m_previousMainCategories
          Button to display previous main categories.
protected  org.eclipse.swt.widgets.Button m_previousSubCategories
          Button to display previous subcategories.
protected  org.eclipse.swt.widgets.Button m_recentItemsButton
          Button to show recent items - that with order in last 24 hours.
protected  org.eclipse.swt.widgets.Label m_selectedCategoriesLabel
          Label displaying selected categories.
protected  java.util.Map m_selectedMainCategories
          What categories are selected in the list.
protected  java.util.Map m_selectedSubCategories
          What subcategories are selected in the list.
protected  java.util.Set m_setListeners
          Set where all listeners listening to the event notifications specific to this object are stored.
protected  org.eclipse.swt.widgets.Button m_shippedItemsButton
          Button to show only shipped items.
protected  int[] m_showButtonsState
          variable with current show status.
protected  int m_specialFlags
          Variable for special flags, it is combination of SF_XXX values.
protected  org.opensubsystems.patterns.listdata.data.ListOptions m_subCategoryOptions
          Option data for the list of subcategories.
protected  org.eclipse.swt.widgets.Composite m_subCategoryRow
          Control which contains buttons for subcategories.
protected  org.eclipse.swt.widgets.Table m_table
          Table with list of items.
static int MAIN_CATEGORY_COLUMNS
          How many columns to display categories in.
static int MAIN_CATEGORY_COUNT
          How many main categories do we display above the list.
static int MAX_FIND_LENGTH_TEXT
          Maximal length of text user can search for.
static int SF_ISSUED
          Do not create Show Issued button.
static int SF_NOMISSING
          Do not create Show Missing button.
static int SF_NONE
          No special flags value.
static int SF_NORECENT
          Do not create Show Recent button.
static int SF_PERMANENT
          Do not create Show Permanent button.
static int SHOW_ALL
          constant for show all items status.
static int SHOW_DEFAULT
          constant for show all items status.
static int SHOW_ISSUED
          constant for show shipped items status.
static int SHOW_MISSING
          constant for show missing items status.
static int SHOW_NONE
          No filter is selected.
static int SHOW_RECENT
          constant for show recent items status.
static int SHOW_SHIPPED
          constant for show shipped items status.
static int SUB_CATEGORY_COUNT
          How many subcategories do we display above the list.
 
Fields inherited from class org.eclipse.swt.widgets.Composite
embeddedHandle
 
Fields inherited from class org.eclipse.swt.widgets.Widget
handle
 
Constructor Summary
CategorizedItemsTable(org.eclipse.swt.widgets.Composite parent, org.opensubsystems.core.application.ThickClientModule module, Inventory defaultInventory, java.util.Map selectedCategories, java.util.Map selectedSubCategories, int[] showState, int specialFlags, int displayedDataType, java.lang.Integer[] permFilterState)
          Constructor
 
Method Summary
 void addCategorizedItemsTableListener(CategorizedItemsTableListener listener)
          Add listener for this dialog.
protected  void allItemsButton()
          All button pressed
protected  void categoriesLoaded(boolean isEmpty)
          Called when categories are loaded from db
protected  void findItems()
          Find in either all items or in the current category
protected  org.opensubsystems.patterns.listdata.logic.ListController getListController()
          Get list controller to use.
 int getSelectedCategoryId()
          Get selected category id or DataObject.NEW_ID if subcategory isn't selected.
 int getSelectedSubcategoryId()
          Get selected subcategory id or DataObject.NEW_ID if subcategory isn't selected.
 org.eclipse.swt.widgets.Table getTable()
          Get table displaying the items
protected  boolean isPermanentState()
          Get current permanent button state.
protected  void issuedItemsButton()
          Issued button pressed
protected abstract  void loadItems()
          Load items asynchronously.
protected  void loadMainCategories()
          Load categories to the main category controls.
protected  void loadNextMainCategories()
          Load next page of categories to the main category controls.
protected  void loadNextSubcategories()
          Load next page of categories to the subcategory controls.
protected  void loadPreviousMainCategories()
          Load previous page of categories to the main category controls.
protected  void loadPreviousSubcategories()
          Load previous page of categories to the subcategory controls.
protected  void loadSubcategories()
          Load subcategories to the subcategory controls.
protected  void missingItemsButton()
          Recent button pressed
protected  void notifyCategorySelected(int categoryId)
          Notification function
protected  void permanentItemsButton()
          Permanent button pressed
protected  void recentItemsButton()
          Recent button pressed
 void removeCategorizedItemsTableListener(CategorizedItemsTableListener listener)
          Remove listener from this ncharacter pad.
protected  void setTableLabel()
          Set label above the table describing what kind of items does the table contains.
protected  void shippedItemsButton()
          Shipped button pressed
protected  void showAllCategories()
          Show all categories.
protected  void showAllSubCategories()
          Show all subcategories.
 boolean stopLoading(org.opensubsystems.patterns.listdata.util.AsyncDataLoader loader)
          
protected  void updateMainCategoryControls(java.lang.Object[] data)
          Update main category controls with the category data loaded using list interface
protected  boolean updateMainCategoryControlState(org.eclipse.swt.widgets.Button mainCategoryButton)
          Update state of the main category control after user selected some main category.
protected  void updateSubCategoryControls(java.lang.Object[] data)
          Update subcategory controls with the category data loaded using list interface.
protected  boolean updateSubCategoryControlState(org.eclipse.swt.widgets.Button subCategoryButton)
          Update state of the subcategory control after user selected some sub category.
 
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, computeSize, getChildren, getClientArea, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, setFocus, setLayout, setLayoutDeferred, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getBorderWidth, getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addFocusListener, addHelpListener, addKeyListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addPaintListener, addTraverseListener, computeSize, forceFocus, getAccessible, getBackground, getBounds, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removePaintListener, removeTraverseListener, setBackground, setBounds, setBounds, setCapture, setCursor, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.opensubsystems.patterns.listdata.util.AsyncDataLoaderOwner
allDataLoaded, getInitialListOptions, processData
 

Field Detail

FIND_BUTTONS

public static final java.lang.String[] FIND_BUTTONS
Constant for Find buttons in char pad.


MAX_FIND_LENGTH_TEXT

public static final int MAX_FIND_LENGTH_TEXT
Maximal length of text user can search for.

See Also:
Constant Field Values

SF_NONE

public static final int SF_NONE
No special flags value.

See Also:
Constant Field Values

SF_NORECENT

public static final int SF_NORECENT
Do not create Show Recent button.

See Also:
Constant Field Values

SF_NOMISSING

public static final int SF_NOMISSING
Do not create Show Missing button.

See Also:
Constant Field Values

SF_PERMANENT

public static final int SF_PERMANENT
Do not create Show Permanent button.

See Also:
Constant Field Values

SF_ISSUED

public static final int SF_ISSUED
Do not create Show Issued button.

See Also:
Constant Field Values

DISPLAY_UNKNOVN

public static final int DISPLAY_UNKNOVN
Constant for showed data type.

See Also:
Constant Field Values

DISPLAY_INVENTORY

public static final int DISPLAY_INVENTORY
Show item types in inventory.

See Also:
Constant Field Values

DISPLAY_ISSUED

public static final int DISPLAY_ISSUED
Show item types with issued information.

See Also:
Constant Field Values

DISPLAY_ISSUED_WITHOUT_FILTERS

public static final int DISPLAY_ISSUED_WITHOUT_FILTERS
Show item types with issued information.

See Also:
Constant Field Values

MAIN_CATEGORY_COLUMNS

public static final int MAIN_CATEGORY_COLUMNS
How many columns to display categories in.

See Also:
Constant Field Values

MAIN_CATEGORY_COUNT

public static final int MAIN_CATEGORY_COUNT
How many main categories do we display above the list. Only 6 in first row + (All, <, >) , 9 in next and 9 in third.

See Also:
Constant Field Values

SUB_CATEGORY_COUNT

public static final int SUB_CATEGORY_COUNT
How many subcategories do we display above the list.

See Also:
Constant Field Values

SHOW_NONE

public static final int SHOW_NONE
No filter is selected.

See Also:
Constant Field Values

SHOW_RECENT

public static final int SHOW_RECENT
constant for show recent items status.

See Also:
Constant Field Values

SHOW_SHIPPED

public static final int SHOW_SHIPPED
constant for show shipped items status.

See Also:
Constant Field Values

SHOW_MISSING

public static final int SHOW_MISSING
constant for show missing items status.

See Also:
Constant Field Values

SHOW_ALL

public static final int SHOW_ALL
constant for show all items status.

See Also:
Constant Field Values

SHOW_ISSUED

public static final int SHOW_ISSUED
constant for show shipped items status.

See Also:
Constant Field Values

SHOW_DEFAULT

public static final int SHOW_DEFAULT
constant for show all items status.

See Also:
Constant Field Values

m_module

protected org.opensubsystems.core.application.ThickClientModule m_module
Module displaying this table.


m_loader

protected org.opensubsystems.patterns.listdata.util.AsyncDataLoader m_loader
The last started loader. Used for detection when to stop loader.


m_arMainCategoryButtons

protected org.eclipse.swt.widgets.Button[] m_arMainCategoryButtons
Row of buttons displaying main category items.


m_allMainCategories

protected org.eclipse.swt.widgets.Button m_allMainCategories
Button to display all main categories.


m_previousMainCategories

protected org.eclipse.swt.widgets.Button m_previousMainCategories
Button to display previous main categories.


m_nextMainCategories

protected org.eclipse.swt.widgets.Button m_nextMainCategories
Button to display next main categories.


m_arSubCategoryButtons

protected org.eclipse.swt.widgets.Button[] m_arSubCategoryButtons
Row of buttons displaying subcategory items.


m_allSubCategories

protected org.eclipse.swt.widgets.Button m_allSubCategories
Button to display all subcategories for some main category.


m_previousSubCategories

protected org.eclipse.swt.widgets.Button m_previousSubCategories
Button to display previous subcategories.


m_nextSubCategories

protected org.eclipse.swt.widgets.Button m_nextSubCategories
Button to display next subcategories.


m_allItemsButton

protected org.eclipse.swt.widgets.Button m_allItemsButton
Button to show all (not only shipped) items.


m_shippedItemsButton

protected org.eclipse.swt.widgets.Button m_shippedItemsButton
Button to show only shipped items.


m_issuedItemsButton

protected org.eclipse.swt.widgets.Button m_issuedItemsButton
Button to show only shipped items.


m_recentItemsButton

protected org.eclipse.swt.widgets.Button m_recentItemsButton
Button to show recent items - that with order in last 24 hours.


m_missingItemsButton

protected org.eclipse.swt.widgets.Button m_missingItemsButton
Button to show missing items - that which the user didn't return on time


m_findItemsButton

protected org.eclipse.swt.widgets.Button m_findItemsButton
Button to show CharacterPad dialog for find function


m_permanentItemsButton

protected org.eclipse.swt.widgets.Button m_permanentItemsButton
Button to show permanent items


m_mainCategoryOptions

protected org.opensubsystems.patterns.listdata.data.ListOptions m_mainCategoryOptions
Option data for the list of main categories.


m_subCategoryOptions

protected org.opensubsystems.patterns.listdata.data.ListOptions m_subCategoryOptions
Option data for the list of subcategories.


m_selectedMainCategories

protected java.util.Map m_selectedMainCategories
What categories are selected in the list. Key is the id, category is the value;


m_selectedSubCategories

protected java.util.Map m_selectedSubCategories
What subcategories are selected in the list. Key is the id, category is the value;


m_selectedCategoriesLabel

protected org.eclipse.swt.widgets.Label m_selectedCategoriesLabel
Label displaying selected categories.


m_defaultInventory

protected Inventory m_defaultInventory
Inventory which is used to load items from.


m_categoryRow

protected org.eclipse.swt.widgets.Composite m_categoryRow
Control which contains buttons for main categories.


m_subCategoryRow

protected org.eclipse.swt.widgets.Composite m_subCategoryRow
Control which contains buttons for subcategories.


m_table

protected org.eclipse.swt.widgets.Table m_table
Table with list of items.


m_showButtonsState

protected int[] m_showButtonsState
variable with current show status. It can be one of values above


m_likeText

protected java.lang.String m_likeText
Like part of sql from CharacterPad


m_displayedDataType

protected int m_displayedDataType
What data are displayed in table


m_extraFiltersButton

protected org.eclipse.swt.widgets.Button m_extraFiltersButton
The most right button with from the series of filter buttons.


m_permFilterState

protected java.lang.Integer[] m_permFilterState
Current permanent button state


m_setListeners

protected java.util.Set m_setListeners
Set where all listeners listening to the event notifications specific to this object are stored.


m_specialFlags

protected int m_specialFlags
Variable for special flags, it is combination of SF_XXX values.

Constructor Detail

CategorizedItemsTable

public CategorizedItemsTable(org.eclipse.swt.widgets.Composite parent,
                             org.opensubsystems.core.application.ThickClientModule module,
                             Inventory defaultInventory,
                             java.util.Map selectedCategories,
                             java.util.Map selectedSubCategories,
                             int[] showState,
                             int specialFlags,
                             int displayedDataType,
                             java.lang.Integer[] permFilterState)
                      throws org.opensubsystems.core.error.OSSException
Constructor

Parameters:
parent - - who is parent of this screen
module - - module displaying this table
defaultInventory - - Inventory which is used in the system.
selectedCategories - - what categories are selected in the list of items. Key is the id, category is the value;
selectedSubCategories - - what subcategories are selected in the list of items. Key is the id, category is the value.
showState - - which show button will be togled one of DISPLAY_UNKNOVN, SHOW_RECENT, SHOW_SHIPPED, SHOW_MISSING, SHOW_ALL, SHOW_DEFAULT
specialFlags - - combination of special flags (SF_XXXX)
displayedDataType - - displayed data type constant. One of DISPLAY_UNKNOVN, DISPLAY_INVENTORY, DISPLAY_ISSUED, DISPLAY_ISSUED_WITHOUT_FILTERS
permFilterState - - permanent button state
Throws:
org.opensubsystems.core.error.OSSException - - an error initializing the screen
Method Detail

stopLoading

public boolean stopLoading(org.opensubsystems.patterns.listdata.util.AsyncDataLoader loader)

Specified by:
stopLoading in interface org.opensubsystems.patterns.listdata.util.AsyncDataLoaderOwner

getTable

public org.eclipse.swt.widgets.Table getTable()
Get table displaying the items

Returns:
Table

isPermanentState

protected boolean isPermanentState()
Get current permanent button state.

Returns:
boolean

addCategorizedItemsTableListener

public void addCategorizedItemsTableListener(CategorizedItemsTableListener listener)
Add listener for this dialog.

Parameters:
listener - - listener to add

removeCategorizedItemsTableListener

public void removeCategorizedItemsTableListener(CategorizedItemsTableListener listener)
Remove listener from this ncharacter pad.

Parameters:
listener - - listener to remove

getSelectedSubcategoryId

public int getSelectedSubcategoryId()
Get selected subcategory id or DataObject.NEW_ID if subcategory isn't selected.

Returns:
int

getSelectedCategoryId

public int getSelectedCategoryId()
Get selected category id or DataObject.NEW_ID if subcategory isn't selected.

Returns:
int - selected category id or DataObject.NEW_ID if subcategory isn't selected.

loadMainCategories

protected void loadMainCategories()
                           throws org.opensubsystems.core.error.OSSException
Load categories to the main category controls.

Throws:
org.opensubsystems.core.error.OSSException - - an error loading categories

loadPreviousMainCategories

protected void loadPreviousMainCategories()
Load previous page of categories to the main category controls.


loadNextMainCategories

protected void loadNextMainCategories()
Load next page of categories to the main category controls.


updateMainCategoryControls

protected void updateMainCategoryControls(java.lang.Object[] data)
Update main category controls with the category data loaded using list interface

Parameters:
data - - data loaded using ListControllerImpl

updateMainCategoryControlState

protected boolean updateMainCategoryControlState(org.eclipse.swt.widgets.Button mainCategoryButton)
Update state of the main category control after user selected some main category.

Parameters:
mainCategoryButton - - button representing main category
Returns:
boolean - true if selected or false if not

showAllCategories

protected void showAllCategories()
Show all categories.


setTableLabel

protected void setTableLabel()
Set label above the table describing what kind of items does the table contains.


showAllSubCategories

protected void showAllSubCategories()
Show all subcategories.


loadSubcategories

protected void loadSubcategories()
                          throws org.opensubsystems.core.error.OSSException
Load subcategories to the subcategory controls.

Throws:
org.opensubsystems.core.error.OSSException - - an error loading categories

loadPreviousSubcategories

protected void loadPreviousSubcategories()
Load previous page of categories to the subcategory controls.


loadNextSubcategories

protected void loadNextSubcategories()
Load next page of categories to the subcategory controls.


updateSubCategoryControls

protected void updateSubCategoryControls(java.lang.Object[] data)
Update subcategory controls with the category data loaded using list interface.

Parameters:
data - - data loaded using ListControllerImpl

findItems

protected void findItems()
Find in either all items or in the current category


allItemsButton

protected void allItemsButton()
All button pressed


shippedItemsButton

protected void shippedItemsButton()
Shipped button pressed


recentItemsButton

protected void recentItemsButton()
Recent button pressed


permanentItemsButton

protected void permanentItemsButton()
Permanent button pressed


issuedItemsButton

protected void issuedItemsButton()
Issued button pressed


missingItemsButton

protected void missingItemsButton()
Recent button pressed


updateSubCategoryControlState

protected boolean updateSubCategoryControlState(org.eclipse.swt.widgets.Button subCategoryButton)
Update state of the subcategory control after user selected some sub category.

Parameters:
subCategoryButton - - button representing subcategory
Returns:
boolean - true if selected or false if not

loadItems

protected abstract void loadItems()
Load items asynchronously.


notifyCategorySelected

protected void notifyCategorySelected(int categoryId)
Notification function

Parameters:
categoryId - - id of selected category or DataObject.NEW_ID for all

categoriesLoaded

protected void categoriesLoaded(boolean isEmpty)
Called when categories are loaded from db

Parameters:
isEmpty - - true if db are no categories

getListController

protected org.opensubsystems.patterns.listdata.logic.ListController getListController()
                                                                               throws org.opensubsystems.core.error.OSSException
Get list controller to use.

Returns:
ListController
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured


Copyright © 2003 - 2006 OpenSubsystems s.r.o.