ch.sahits.game.graphic.display.dialog
Class TradingOfficeBalanceDialog

java.lang.Object
  extended by ch.sahits.game.graphic.display.dialog.OpenPatricianGameDialog
      extended by ch.sahits.game.graphic.display.dialog.TradingOfficeBalanceDialog
All Implemented Interfaces:
IEventListener, Renderable, RenderablePart

public class TradingOfficeBalanceDialog
extends OpenPatricianGameDialog
implements IEventListener, RenderablePart


Nested Class Summary
private static class TradingOfficeBalanceDialog.DialogPositions
          This class holds the positions where different elements are placed on the dialog.
 
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  IOpenPatricianPainter opPainter
           
private  TradingOfficeBalanceDialog.DialogPositions positions
          Hold all the positioning information, initialized in initBackgroundImage
 
Fields inherited from class ch.sahits.game.graphic.display.dialog.OpenPatricianGameDialog
city, inset, loader
 
Constructor Summary
TradingOfficeBalanceDialog(Point topLeft, double scale, CityPlayerProxy cityProxy)
           
 
Method Summary
private  void drawBalanceRow(Graphics2D g2d, BufferedImage coin, int y, int lastWeek, int forcaset)
          Draw the balance line with the last weeks values and the forcast values
private  void drawBalanceRow(Graphics2D g2d, int y, int amount, int people, int maxPeople, String label)
           
private  void drawBalanceSum(Graphics2D g2d, ITradingOffice office, BufferedImage coin, int y)
          Draw the balance line summing up
private  void drawOfficeTradeing(Graphics2D g2d, ITradingOffice office, BufferedImage coin, int y)
          Draw the balance line for the office traiding
private  void drawOtherCosts(Graphics2D g2d, ITradingOffice office, BufferedImage coin, int y)
          Draw the balance line for other costs
private  void drawPropertyTax(Graphics2D g2d, ITradingOffice office, BufferedImage coin, int y)
          Draw the balance line for the property taxes
private  void drawRentalIncome(Graphics2D g2d, ITradingOffice office, BufferedImage coin, int y)
          Draw the balance line for the rental income
private  int drawRow(Graphics2D g2d, int y, int leftBorder, String text)
          Draw a text string at a defined position.
private  void drawStewardCosts(Graphics2D g2d, ITradingOffice office, BufferedImage coin, int y)
          Draw the balance line for the steward costs
private  void drawTableHeader(Graphics2D g2d, int y)
          Draw the table header
private  void drawWageCosts(Graphics2D g2d, ITradingOffice office, BufferedImage coin, int y)
          Draw the balance line for the wage costs
 void gameRender(Graphics gScr)
           
 void gameUpdate(Event e, Object notice)
           
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 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

imageUtils

private IImageUtilities imageUtils
reference to the utilities for image manipulation


opPainter

private IOpenPatricianPainter opPainter

enabled

private boolean enabled

footerPolygons

private ClickablePolygons footerPolygons

positions

private TradingOfficeBalanceDialog.DialogPositions positions
Hold all the positioning information, initialized in initBackgroundImage

Constructor Detail

TradingOfficeBalanceDialog

public TradingOfficeBalanceDialog(Point topLeft,
                                  double scale,
                                  CityPlayerProxy cityProxy)
Method Detail

init

protected void init()
Description copied from class: OpenPatricianGameDialog
Initialize class specific stuff which might be need later in the initialisation

Overrides:
init in class OpenPatricianGameDialog

initiatePolygons

protected void initiatePolygons()
Description copied from class: OpenPatricianGameDialog
Instanciate the any polygon member variables. This method is intended to be overriden if the dialog uses polygons.

Overrides:
initiatePolygons in class OpenPatricianGameDialog

isEnabled

public boolean isEnabled()
Specified by:
isEnabled in interface Renderable

setEnabled

public void setEnabled(boolean flag)
Specified by:
setEnabled in interface Renderable

gameUpdate

public void gameUpdate(Event e,
                       Object notice)
Specified by:
gameUpdate in interface IEventListener
Specified by:
gameUpdate in interface Renderable

drawTableHeader

private void drawTableHeader(Graphics2D g2d,
                             int y)
                      throws FontFormatException,
                             IOException
Draw the table header

Parameters:
g2d -
y - position of the table header baseline
Throws:
FontFormatException
IOException

drawRow

private int drawRow(Graphics2D g2d,
                    int y,
                    int leftBorder,
                    String text)
             throws FontFormatException,
                    IOException
Draw a text string at a defined position. The Y-position is passed as an argument, updated for the next row and returned. The X-coordinate is computed from the left border argument and the visual length of the text string

Parameters:
g2d - Graphic context
y - position
leftBorder - left inset
text - to be drawn
Returns:
updated y coordinate
Throws:
FontFormatException
IOException

initBackgroundImage

protected BufferedImage initBackgroundImage(IImageLoader loader,
                                            Point topLeft)
Description copied from class: OpenPatricianGameDialog
Initialize the background image that is stored as a reference. This method should be overridden by any subclass that contains static elements in the dialog. This implementation returns a copy of the background image stored in the cache, so that image can be further processed, without inflicting conflicts.

Overrides:
initBackgroundImage in class OpenPatricianGameDialog
Parameters:
loader - ImageLoader to retrieve images
Returns:
Image that will be stored as background

gameRender

public void gameRender(Graphics gScr)
Specified by:
gameRender in interface Renderable
Overrides:
gameRender in class OpenPatricianGameDialog

drawBalanceRow

private void drawBalanceRow(Graphics2D g2d,
                            int y,
                            int amount,
                            int people,
                            int maxPeople,
                            String label)
                     throws FontFormatException,
                            IOException
Throws:
FontFormatException
IOException

drawBalanceSum

private void drawBalanceSum(Graphics2D g2d,
                            ITradingOffice office,
                            BufferedImage coin,
                            int y)
                     throws FontFormatException,
                            IOException
Draw the balance line summing up

Parameters:
g2d - Graphic context
office - Trading office instance
coin - image
y - position
Throws:
FontFormatException
IOException

drawOtherCosts

private void drawOtherCosts(Graphics2D g2d,
                            ITradingOffice office,
                            BufferedImage coin,
                            int y)
                     throws FontFormatException,
                            IOException
Draw the balance line for other costs

Parameters:
g2d - Graphic context
office - Trading office instance
coin - image
y - position
Throws:
IOException
FontFormatException

drawStewardCosts

private void drawStewardCosts(Graphics2D g2d,
                              ITradingOffice office,
                              BufferedImage coin,
                              int y)
                       throws FontFormatException,
                              IOException
Draw the balance line for the steward costs

Parameters:
g2d - Graphic context
office - Trading office instance
coin - image
y - position
Throws:
FontFormatException
IOException

drawOfficeTradeing

private void drawOfficeTradeing(Graphics2D g2d,
                                ITradingOffice office,
                                BufferedImage coin,
                                int y)
                         throws FontFormatException,
                                IOException
Draw the balance line for the office traiding

Parameters:
g2d - Graphic context
office - Trading office instance
coin - image
y - position
Throws:
IOException
FontFormatException

drawPropertyTax

private void drawPropertyTax(Graphics2D g2d,
                             ITradingOffice office,
                             BufferedImage coin,
                             int y)
                      throws FontFormatException,
                             IOException
Draw the balance line for the property taxes

Parameters:
g2d - Graphic context
office - Trading office instance
coin - image
y - position
Throws:
FontFormatException
IOException

drawWageCosts

private void drawWageCosts(Graphics2D g2d,
                           ITradingOffice office,
                           BufferedImage coin,
                           int y)
                    throws FontFormatException,
                           IOException
Draw the balance line for the wage costs

Parameters:
g2d - Graphic context
office - Trading office instance
coin - image
y - position
Throws:
FontFormatException
IOException

drawRentalIncome

private void drawRentalIncome(Graphics2D g2d,
                              ITradingOffice office,
                              BufferedImage coin,
                              int y)
                       throws FontFormatException,
                              IOException
Draw the balance line for the rental income

Parameters:
g2d - Graphic context
office - Trading office instance
coin - image
y - position
Throws:
FontFormatException
IOException

drawBalanceRow

private void drawBalanceRow(Graphics2D g2d,
                            BufferedImage coin,
                            int y,
                            int lastWeek,
                            int forcaset)
                     throws FontFormatException,
                            IOException
Draw the balance line with the last weeks values and the forcast values

Parameters:
g2d - Graphic context
coin - image
y - position
lastWeek - value of the last week
forcaset - valeu forcast of the current week
Throws:
FontFormatException
IOException


Copyright © 2011-2012 Sahits GmbH. All Rights Reserved.