pandora
Class CommandBean

java.lang.Object
  |
  +--pandora.CommandBean

public class CommandBean
extends java.lang.Object

JavaBean component used by command.jsp.
Retrieves the command items and article list from the Session object

alexis.grandemange@pagebox.net

Copyright (c) 2002-2003 Alexis Grandemange

This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public License
 as published by the Free Software Foundation; version 2.1 of the
 License.
 This library is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 GNU Lesser General Public License for more details.
 A copy of the GNU Lesser General Public License lesser.txt should be
 included in the distribution.

Version:
0, 0, 1
Author:
Alexis Grandemange

Field Summary
(package private)  java.util.TreeMap articles
          Articles sorted by id.
(package private)  java.util.TreeMap items
          Command items sorted by id.
(package private)  java.lang.Integer updatedId
          ID of the article whose update has been requested.
 
Constructor Summary
CommandBean()
          Default constructor called by CommandBean
CommandBean(java.util.TreeMap articles)
          Constructor called by CommandCtrl.
 
Method Summary
 java.lang.String getArticles()
          Return a Javascript snippet like:
price[0]="100";
price[1]="30";
price[2]="50";
where the key is the article ID and the value is the article price
 java.lang.String getDisabled()
          Used to disable the article selection in update mode.
 java.lang.String getItems()
          Return a HTML table row list with rows like
<tr>
<td><button name="delete" onClick=del("12345")> Delete</button></td> <td><button name="update" onClick=upd("12345")> Update</button></td> <td>xxxxxxxxx</td><td>5</td><td> 500</td></tr>
 java.lang.String getOptions()
          Return a HTML option list like
<option value="0">xxxxxxxxx</option>
<option value="1">xxxxxxxx2</option>
<option value="2" selected="true">xxxxxxxx3</option>
where the attribute is the article ID and the content is the article name
 java.lang.String getPrice()
          Used to initialize the article price in update mode.
 java.lang.String getQty()
          Used to initialize the number of articles in update mode.
 java.lang.String getUpdatedId()
          Used by CommandCtrl for the update/commit handling.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

articles

java.util.TreeMap articles
Articles sorted by id. Key: article id Value: Article object


items

java.util.TreeMap items
Command items sorted by id. Key: article id Value: Item object


updatedId

java.lang.Integer updatedId
ID of the article whose update has been requested. null if no update ongoing.

Constructor Detail

CommandBean

public CommandBean()
Default constructor called by CommandBean


CommandBean

public CommandBean(java.util.TreeMap articles)
Constructor called by CommandCtrl.

Parameters:
articles - article list
Method Detail

getArticles

public java.lang.String getArticles()
Return a Javascript snippet like:
price[0]="100";
price[1]="30";
price[2]="50";
where the key is the article ID and the value is the article price


getItems

public java.lang.String getItems()
Return a HTML table row list with rows like
<tr>
<td><button name="delete" onClick=del("12345")> Delete</button></td> <td><button name="update" onClick=upd("12345")> Update</button></td> <td>xxxxxxxxx</td><td>5</td><td> 500</td></tr>


getOptions

public java.lang.String getOptions()
Return a HTML option list like
<option value="0">xxxxxxxxx</option>
<option value="1">xxxxxxxx2</option>
<option value="2" selected="true">xxxxxxxx3</option>
where the attribute is the article ID and the content is the article name


getUpdatedId

public java.lang.String getUpdatedId()
Used by CommandCtrl for the update/commit handling. ID of the article in update.


getDisabled

public java.lang.String getDisabled()
Used to disable the article selection in update mode.


getQty

public java.lang.String getQty()
Used to initialize the number of articles in update mode.


getPrice

public java.lang.String getPrice()
Used to initialize the article price in update mode.