org.opensubsystems.inventory.application.swt
Class ItemIdentificationPage

java.lang.Object
  extended by org.opensubsystems.inventory.application.swt.ItemIdentificationPage

public class ItemIdentificationPage
extends java.lang.Object

Identification page of item dialog.

Version:
$Id: ItemIdentificationPage.java,v 1.6 2007/01/07 06:14:07 bastafidli Exp $
Author:
Martin Cerba
Code reviewer:
Miro Halas
Code reviewed:
1.2 2006/04/05 05:19:17 bastafidli

Field Summary
protected  org.eclipse.swt.widgets.Button m_addButton
          Add identification button.
protected  org.eclipse.swt.widgets.Composite m_clientArea
          Client area containing all the other controls.
protected  double m_defaultCost
          Default cost value for newly created identifications.
protected  org.eclipse.swt.widgets.Button m_editNumberButton
          Button for not unique internal number.
protected  org.eclipse.swt.widgets.Label m_editNumberLabel
          Label for not unique internal number.
protected  org.eclipse.swt.widgets.Text m_editNumberText
          Edit text for not unique internal number.
protected  ItemDialog m_itemDialog
          Dialog this gui is representing.
protected  java.util.List m_lstIdentifications
          List of all identifications in table.
protected  org.eclipse.swt.widgets.Button m_modifyButton
          Modify identification button.
protected  org.eclipse.swt.widgets.Button m_removeButton
          Remove identification button.
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.Table m_table
          Table with individual identifications.
protected  org.eclipse.swt.widgets.Label m_tableLabel
          Label for table with individual identifications.
 
Constructor Summary
ItemIdentificationPage()
           
 
Method Summary
 void addItemIdentificationPageListener(ItemIdentificationPageListener listener)
          Add listener for this dialog.
 org.eclipse.swt.widgets.Composite createClientArea(ItemDialog itemDialog, org.eclipse.swt.widgets.TabFolder tab, Item itemData, java.lang.String strInternalNumber)
          Create client area of this page.
 java.util.List getIdentifications()
          Get list of individually identifiable items.
 java.lang.String getInternalNumberForNonUniqueItems()
          Get internal number for non uniquely tracked items.
protected  org.opensubsystems.patterns.listdata.logic.ListController getListController()
          Get list controller to use.
 int getNotRetiredIdentificationsCount()
          Get count of not retired identifications
 int getRetiredCount()
          Get count of retired identifications.
 boolean isUniquelyTracked()
          Check if the units of this item are individually tracked or not
protected  void loadIdentifications(int iItemId)
          Load all identifications into a table
protected  void notifyAverageCost(double dAverageCost)
          Notify all listeners when average cost changes.
protected  void notifyCostChanged(double dCost)
          Notify all listeners when cost changes.
protected  void notifyCostListeners()
          Notify all listeners functions about changes to the cost values based on the changes to individual identifications.
protected  void notifyIdentificationCountChanged(int iCount)
          Notify all listeners when number of individual identifications changes.
protected  void notifyRetiredChanged(boolean bRetired)
          Notify all listeners when retired flag in some identifications changes.
 void removeItemIdentificationPageListener(ItemIdentificationPageListener listener)
          Remove listener from this dialog.
 void setDefaultCostValue(double dCost)
          Set the default cost for all existing and future individually identifiable items.
protected  void updateTable()
          Update the table based on changes to individual identifications.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_setListeners

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


m_editNumberLabel

protected org.eclipse.swt.widgets.Label m_editNumberLabel
Label for not unique internal number.


m_editNumberText

protected org.eclipse.swt.widgets.Text m_editNumberText
Edit text for not unique internal number.


m_editNumberButton

protected org.eclipse.swt.widgets.Button m_editNumberButton
Button for not unique internal number.


m_tableLabel

protected org.eclipse.swt.widgets.Label m_tableLabel
Label for table with individual identifications.


m_table

protected org.eclipse.swt.widgets.Table m_table
Table with individual identifications.


m_addButton

protected org.eclipse.swt.widgets.Button m_addButton
Add identification button.


m_modifyButton

protected org.eclipse.swt.widgets.Button m_modifyButton
Modify identification button.


m_removeButton

protected org.eclipse.swt.widgets.Button m_removeButton
Remove identification button.


m_clientArea

protected org.eclipse.swt.widgets.Composite m_clientArea
Client area containing all the other controls.


m_itemDialog

protected ItemDialog m_itemDialog
Dialog this gui is representing.


m_defaultCost

protected double m_defaultCost
Default cost value for newly created identifications.


m_lstIdentifications

protected java.util.List m_lstIdentifications
List of all identifications in table. These needs to be kept in this list since the identifications are not persisted immediately but are kept in memory instead until te whole items is saved.

Constructor Detail

ItemIdentificationPage

public ItemIdentificationPage()
Method Detail

createClientArea

public org.eclipse.swt.widgets.Composite createClientArea(ItemDialog itemDialog,
                                                          org.eclipse.swt.widgets.TabFolder tab,
                                                          Item itemData,
                                                          java.lang.String strInternalNumber)
                                                   throws org.opensubsystems.core.error.OSSException
Create client area of this page.

Parameters:
itemDialog - - dialog displaying this page
tab - - control this page belongs to
itemData - - item to create or edit
strInternalNumber - - internal identification number it this is a non uniquely tracked item or if the item is not unitquely tracked, can be null. If this is a new item it should be the next available value (of course this is just a suggestion since the availability can change by the time they are done)
Returns:
Composite - client area of the page
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

addItemIdentificationPageListener

public void addItemIdentificationPageListener(ItemIdentificationPageListener listener)
Add listener for this dialog.

Parameters:
listener - - listener to add

removeItemIdentificationPageListener

public void removeItemIdentificationPageListener(ItemIdentificationPageListener listener)
Remove listener from this dialog.

Parameters:
listener - - listener to remove

setDefaultCostValue

public void setDefaultCostValue(double dCost)
Set the default cost for all existing and future individually identifiable items.

Parameters:
dCost - - default cost value

getIdentifications

public java.util.List getIdentifications()
Get list of individually identifiable items.

Returns:
List - individually identifiable items

isUniquelyTracked

public boolean isUniquelyTracked()
Check if the units of this item are individually tracked or not

Returns:
boolean - if true, units of this item are uniqualy tracked

getNotRetiredIdentificationsCount

public int getNotRetiredIdentificationsCount()
Get count of not retired identifications

Returns:
int - count of not retired identifications on this page

getRetiredCount

public int getRetiredCount()
Get count of retired identifications.

Returns:
int - count of retired identifications on this page

getInternalNumberForNonUniqueItems

public java.lang.String getInternalNumberForNonUniqueItems()
Get internal number for non uniquely tracked items.

Returns:
String - if there are not identifications for unique items entered then this returns internal number for non uniquelly tracked items otherwise if item is uniquely tracked returns null

loadIdentifications

protected void loadIdentifications(int iItemId)
                            throws org.opensubsystems.core.error.OSSException
Load all identifications into a table

Parameters:
iItemId - - id of the item to load identifications for
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

updateTable

protected void updateTable()
Update the table based on changes to individual identifications.


notifyCostListeners

protected void notifyCostListeners()
Notify all listeners functions about changes to the cost values based on the changes to individual identifications. TODO: ThickClient: This method may be optimized and instead of recalculating the cost every time we can keep track of the values we need and just adjust them for changes we made (added, changed or removed identification).


notifyAverageCost

protected void notifyAverageCost(double dAverageCost)
Notify all listeners when average cost changes. Use this function when not all identification data have the same value.

Parameters:
dAverageCost - - new average cost value

notifyCostChanged

protected void notifyCostChanged(double dCost)
Notify all listeners when cost changes. Use this function when all identification data have the same value.

Parameters:
dCost - - new cost value

notifyIdentificationCountChanged

protected void notifyIdentificationCountChanged(int iCount)
Notify all listeners when number of individual identifications changes.

Parameters:
iCount - - new number of individual identifications

notifyRetiredChanged

protected void notifyRetiredChanged(boolean bRetired)
Notify all listeners when retired flag in some identifications changes.

Parameters:
bRetired - - new retired value

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.