org.opensubsystems.inventory.application.swt
Class ItemUnitPage

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

public class ItemUnitPage
extends java.lang.Object

Unit page of item dialog.

Version:
$Id: ItemUnitPage.java,v 1.5 2007/01/07 06:14:07 bastafidli Exp $
Author:
Martin Cerba
Code reviewer:
Miro Halas
Code reviewed:
1.1 2006/04/05 05:16:38 bastafidli

Field Summary
protected  org.eclipse.swt.widgets.Button m_addButton
          Add unit button.
protected  boolean m_bConsumable
          Cached value of current consumable flag for the item since it affects computation of average cost.
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 units.
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_lstUnits
          List of all units in table.
protected  org.eclipse.swt.widgets.Button m_modifyButton
          Modify unit button.
protected  org.eclipse.swt.widgets.Button m_removeButton
          Remove unit 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 units.
 
Constructor Summary
ItemUnitPage()
           
 
Method Summary
 void addItemUnitPageListener(ItemUnitPageListener 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.
 int getAvailableCount()
          Get sum of all available units.
 double getAverageCost()
          Get average cost of all units.
 java.lang.String getInternalNumber()
          Get internal number for non uniquely tracked items
protected  org.opensubsystems.patterns.listdata.logic.ListController getListController()
          Get list controller to use.
 int getShippedCount()
          Get sum of all shipped units.
 java.util.List getUnits()
          Get list of units.
protected  void loadUnits(int iItemId)
          Load all units into a table
protected  void notifyAvailableCountChanged(int iCount)
          Notify all listeners when average count changes.
protected  void notifyAverageCostChanged(double dAverageCost)
          Notify all listeners when average cost changes.
protected  void notifyShippedCountChanged(int iCount)
          Notify all listeners when shipped count changes.
 void removeItemUnitPageListener(ItemUnitPageListener listener)
          Remove listener from this dialog.
 void setConsumable(boolean bConsumable)
          Set new consumable state if it has changed.
protected  void updateTable()
          Update the table based on changes to units.
 
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_table

protected org.eclipse.swt.widgets.Table m_table
Table with units.


m_addButton

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


m_modifyButton

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


m_removeButton

protected org.eclipse.swt.widgets.Button m_removeButton
Remove unit 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_lstUnits

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


m_defaultCost

protected double m_defaultCost
Default cost value for newly created units. TODO: ThickClient: Does it make sense to specify default cost if all units have to have different cost and therefore the cost amy need to be changed anyway?


m_bConsumable

protected boolean m_bConsumable
Cached value of current consumable flag for the item since it affects computation of average cost.

Constructor Detail

ItemUnitPage

public ItemUnitPage()
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 for this page
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

addItemUnitPageListener

public void addItemUnitPageListener(ItemUnitPageListener listener)
Add listener for this dialog.

Parameters:
listener - - listener to add

removeItemUnitPageListener

public void removeItemUnitPageListener(ItemUnitPageListener listener)
Remove listener from this dialog.

Parameters:
listener - - listener to remove

getInternalNumber

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

Returns:
Stgring - internal number for this item shared by all units

getUnits

public java.util.List getUnits()
Get list of units.

Returns:
List - list of units

getShippedCount

public int getShippedCount()
Get sum of all shipped units.

Returns:
int - sum of all shipped units.

getAvailableCount

public int getAvailableCount()
Get sum of all available units.

Returns:
int - sum of all available units.

getAverageCost

public double getAverageCost()
Get average cost of all units.

Returns:
double - average cost of all units

loadUnits

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

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

updateTable

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


setConsumable

public void setConsumable(boolean bConsumable)
Set new consumable state if it has changed.

Parameters:
bConsumable - - new consumable state of the item

notifyAverageCostChanged

protected void notifyAverageCostChanged(double dAverageCost)
Notify all listeners when average cost changes.

Parameters:
dAverageCost - - new average cost

notifyShippedCountChanged

protected void notifyShippedCountChanged(int iCount)
Notify all listeners when shipped count changes.

Parameters:
iCount - - new shipped count

notifyAvailableCountChanged

protected void notifyAvailableCountChanged(int iCount)
Notify all listeners when average count changes.

Parameters:
iCount - - new average count

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.