|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectch.sahits.game.graphic.display.dialog.OpenPatricianGameDialog
ch.sahits.game.graphic.display.dialog.TradeDialog
public class TradeDialog
Trade dialog for buying/selling from/to the city involving either a ship or the branch office.
| Nested Class Summary | |
|---|---|
private static class |
TradeDialog.DialogPositions
This class holds the positions where different elements are placed on the dialog. |
private class |
TradeDialog.TransferAmountChangeAction
Action to change the chunck size that is to be moved. |
| Nested classes/interfaces inherited from class ch.sahits.game.graphic.display.dialog.OpenPatricianGameDialog |
|---|
OpenPatricianGameDialog.CloseAction |
| Field Summary | |
|---|---|
private boolean |
enabled
|
private ClickablePolygons |
footerPolygons
|
private IImageUtilities |
imageUtils
reference to the utilities for image manipulation |
private static org.apache.log4j.Logger |
logger
|
private ETransferAmount |
movableAmount
The amount that is moved with one click |
private IOpenPatricianPainter |
opPainter
|
private ClickablePolygons |
polygons
|
private TradeDialog.DialogPositions |
positions
Hold all the positioning information, initialized in initBackgroundImage |
private ETransferDialogType |
type
|
| Fields inherited from class ch.sahits.game.graphic.display.dialog.OpenPatricianGameDialog |
|---|
city, inset, loader |
| Constructor Summary | |
|---|---|
TradeDialog(Point topLeft,
double scale,
CityPlayerProxy city,
ETransferDialogType dialogType)
|
|
| Method Summary | |
|---|---|
private int |
drawAvailableAmount(Graphics2D g2d,
ICity city,
ITradingOffice office,
IWare ware,
BufferedImage barrel,
BufferedImage bale,
int y)
Draw the available amount (second column). |
private void |
drawAVGPrice(Graphics2D g2d,
IWare ware,
IShip ship,
ITradingOffice office,
int y)
Draw the average price of the wares stored |
private void |
drawBuyIconText(Graphics2D g2d,
int availableAmount,
IWare ware,
BufferedImage waxSeal,
int y)
Draw the text on the wax seal corresponding to the buy button |
private void |
drawSellIconText(Graphics2D g2d,
int availableAmount,
IWare ware,
BufferedImage waxSeal,
int y)
Draw the text on the wax seal corresponding to the sell button |
private void |
drawStoredAmount(Graphics2D g2d,
IWare ware,
IShip ship,
ITradingOffice office,
int y)
Draw the stored amount (second last column). |
private void |
drawSubTitle(Graphics2D g2d,
int y,
BufferedImage barrel,
int x,
ICity city,
IShip ship,
ITradingOffice office)
Draw the sub title appropriate for the current dialog type onto the graphics context |
private void |
drawTableHeader(Graphics2D g2d,
int y)
Draw the table header |
void |
gameRender(Graphics gScr)
|
void |
gameUpdate(Event e,
Object notice)
|
int |
getAmount(int maxMount)
Retrieve the amount that is to be transferred. |
CityPlayerProxy |
getCityPlayerProxy()
Retrieve the proxy object to access the city and the player |
ETransferDialogType |
getDialogType()
Retrieve the dialog type of this transfer |
ETransferAmount |
getMovableAmount()
Retrieve the amount size that is to be transfer in one chunk. |
private AmountablePrice |
getStoredAmount(IWare ware,
IShip ship,
ITradingOffice office)
Retrieve the amountable object for the ware that is stored. |
protected void |
init()
Initialize class specific stuff which might be need later in the initialisation |
protected BufferedImage |
initBackgroundImage(IImageLoader loader,
Point topLeft)
Initialize the background image that is stored as a reference. |
protected void |
initiatePolygons()
Instanciate the any polygon member variables. |
boolean |
isEnabled()
|
void |
setDialogType(ETransferDialogType type)
set the transfer dialog type |
void |
setEnabled(boolean flag)
|
| Methods inherited from class ch.sahits.game.graphic.display.dialog.OpenPatricianGameDialog |
|---|
getBounds, getInset, initInsets |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface ch.sahits.game.rendering.RenderablePart |
|---|
getBounds |
| Field Detail |
|---|
private static final org.apache.log4j.Logger logger
private boolean enabled
private ETransferAmount movableAmount
private ClickablePolygons polygons
private ClickablePolygons footerPolygons
private TradeDialog.DialogPositions positions
private ETransferDialogType type
private IImageUtilities imageUtils
private IOpenPatricianPainter opPainter
| Constructor Detail |
|---|
public TradeDialog(Point topLeft,
double scale,
CityPlayerProxy city,
ETransferDialogType dialogType)
| Method Detail |
|---|
protected void init()
OpenPatricianGameDialog
init in class OpenPatricianGameDialogprotected void initiatePolygons()
OpenPatricianGameDialog
initiatePolygons in class OpenPatricianGameDialogpublic ETransferDialogType getDialogType()
ITransferable
getDialogType in interface ITransferablepublic void setDialogType(ETransferDialogType type)
ITransferable
setDialogType in interface ITransferabletype - of the transfer dialogpublic int getAmount(int maxMount)
ITransferable
getAmount in interface ITransferablepublic ETransferAmount getMovableAmount()
ITransferable
getMovableAmount in interface ITransferable
public void gameUpdate(Event e,
Object notice)
gameUpdate in interface IEventListenergameUpdate in interface Renderablepublic boolean isEnabled()
isEnabled in interface Renderablepublic void setEnabled(boolean flag)
setEnabled in interface Renderable
private void drawTableHeader(Graphics2D g2d,
int y)
throws FontFormatException,
IOException
g2d - y - position of the table header baseline
FontFormatException
IOException
protected BufferedImage initBackgroundImage(IImageLoader loader,
Point topLeft)
OpenPatricianGameDialog
initBackgroundImage in class OpenPatricianGameDialogloader - ImageLoader to retrieve images
public void gameRender(Graphics gScr)
gameRender in interface RenderablegameRender in class OpenPatricianGameDialog
private void drawAVGPrice(Graphics2D g2d,
IWare ware,
IShip ship,
ITradingOffice office,
int y)
throws FontFormatException,
IOException
g2d - 2D graphics context used for drawingware - Reference to the wareship - Reference to the shipoffice - Trading office in the city, may be null if it does not existy - position of from the top
FontFormatException - Error while creating a font
IOException - Error while reading a resource
private AmountablePrice getStoredAmount(IWare ware,
IShip ship,
ITradingOffice office)
ware - for which the object is to be retrievedship - Reference to the shipoffice - Reference to the trading office
private void drawStoredAmount(Graphics2D g2d,
IWare ware,
IShip ship,
ITradingOffice office,
int y)
throws FontFormatException,
IOException
g2d - 2D graphics context used for drawingware - Reference to the wareship - Reference to the shipy - position of from the top
FontFormatException - Error while creating a font
IOException - Error while reading a resource
private void drawSellIconText(Graphics2D g2d,
int availableAmount,
IWare ware,
BufferedImage waxSeal,
int y)
throws FontFormatException,
IOException
g2d - 2D graphics context used for drawingavailableAmount - amount that is actually availableware - Reference to the warewaxSeal - icony - position of from the top
FontFormatException - Error while creating a font
IOException - Error while reading a resource
private void drawBuyIconText(Graphics2D g2d,
int availableAmount,
IWare ware,
BufferedImage waxSeal,
int y)
throws FontFormatException,
IOException
g2d - 2D graphics context used for drawingavailableAmount - amount that is actually availableware - Reference to the warewaxSeal - icony - position of from the top
FontFormatException - Error while creating a font
IOException - Error while reading a resource
private int drawAvailableAmount(Graphics2D g2d,
ICity city,
ITradingOffice office,
IWare ware,
BufferedImage barrel,
BufferedImage bale,
int y)
throws FontFormatException,
IOException
g2d - 2D graphics context used for drawingcity - Reference to the cityware - Reference to the warebarrel - iconbale - icony - position of from the top
FontFormatException - Error while creating a font
IOException - Error while reading a resource
private void drawSubTitle(Graphics2D g2d,
int y,
BufferedImage barrel,
int x,
ICity city,
IShip ship,
ITradingOffice office)
throws FontFormatException,
IOException
g2d - "D graphics contexty - position from the top to the sub titlebarrel - Iconx - position from the left to the sub titlecity - reference to the cityship - reference to the ship
FontFormatException - Error while creating a font
IOException - Error while reading a resourcepublic CityPlayerProxy getCityPlayerProxy()
ITransferable
getCityPlayerProxy in interface ITransferable
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||