View structure

Page describe components that create game main view. It's useful for development.

All classes described in following text are from module spacewar-game and from package com.jirout.spacewar.viewwindow.

Game is started from class SpaceWarApplication of from SpaceWarApplet. Following diagram show how are visual component structured:

SpaceWarApplication
`-- SpaceWarFrame
    `-- PanelGame
        |-- main menu and all sub-menus
        |-- PanelStatPlanet
        |-- PanelStatFleet
        |-- PanelStartField
        `-- status bar

Classes responsible for each part of main game view are:

View Structure

MVC in view

In view is used MVC pattern. This is used usually in panel class which extends java.swing.JPanel.

When used press some button at panel event is processed in panel controller. Later panel controller calls game controller.

view MVC

View component instantiating

Because there is a cyclic dependency in Panel and it's controller. Panel controller don't have dependency to panel in constructor. Panel controller have setter for panel and during executing panel's constructor is this setter used for passing panel reference to controller.

User roles

In game is just one role, all users have same rights.

Game roles

Use cases

At following image are game usecases:

Use cases