edu.cmu.sun.model
Class SceneModel

java.lang.Object
  extended by edu.cmu.sun.model.Model
      extended by edu.cmu.sun.model.SceneModel

public class SceneModel
extends Model

A state model of the available screen space and column order. The Scene model contains a list of ColumnModels. It is responsible for layout out columns so that they fit on the screen. So, it stacks columns as necessary to make room. It also handles updates to the total amount of screen space left. There are some bugs in this, but it does an okay job for the demo.

Author:
Braden Kowitz, Jake Pierson, Jessica Smith

Field Summary
static float BORDER
           
static float BOTTOM_BORDER
           
(package private)  java.util.List<ColumnModel> columns
           
(package private)  float lastSizeHeight
           
(package private)  float lastSizeWidth
           
static float P2M
           
(package private)  java.util.LinkedList<ColumnModel> recentlyUsedColumns
           
(package private) static float sceneHeight
           
(package private) static float sceneWidth
           
static float SPACING
           
 
Constructor Summary
SceneModel()
           
 
Method Summary
 void addColumn(ColumnModel col)
           
 java.util.List<ColumnModel> getColumnModels()
           
static float getHeight()
           
 ColumnModel getNextColumn(ColumnModel afterThisColumn)
           
 ColumnModel getPrevColumn(ColumnModel beforeThisColumn)
           
private  float getSceneWidth()
           
static float getWidth()
           
 void makeRecent(ColumnModel col)
           
 void makeUnstacked(ColumnModel col)
           
 void removeColumn(ColumnModel col)
           
 void setSize(float height, float width)
           
private  boolean stackOldColumn()
          tries to stack the least recently used column.
private  boolean unstackRecentColumn()
           
 void updateStacking()
           
 
Methods inherited from class edu.cmu.sun.model.Model
addModelListener, needsUpdate, notifyAllListeners, notifyListeners, removeModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

columns

java.util.List<ColumnModel> columns

recentlyUsedColumns

java.util.LinkedList<ColumnModel> recentlyUsedColumns

P2M

public static final float P2M
See Also:
Constant Field Values

BORDER

public static final float BORDER
See Also:
Constant Field Values

BOTTOM_BORDER

public static final float BOTTOM_BORDER
See Also:
Constant Field Values

sceneHeight

static float sceneHeight

sceneWidth

static float sceneWidth

SPACING

public static final float SPACING
See Also:
Constant Field Values

lastSizeWidth

float lastSizeWidth

lastSizeHeight

float lastSizeHeight
Constructor Detail

SceneModel

public SceneModel()
Method Detail

addColumn

public void addColumn(ColumnModel col)

removeColumn

public void removeColumn(ColumnModel col)

getHeight

public static float getHeight()

getWidth

public static float getWidth()

getColumnModels

public java.util.List<ColumnModel> getColumnModels()

getNextColumn

public ColumnModel getNextColumn(ColumnModel afterThisColumn)

getPrevColumn

public ColumnModel getPrevColumn(ColumnModel beforeThisColumn)

makeUnstacked

public void makeUnstacked(ColumnModel col)

makeRecent

public void makeRecent(ColumnModel col)

updateStacking

public void updateStacking()

unstackRecentColumn

private boolean unstackRecentColumn()

stackOldColumn

private boolean stackOldColumn()
tries to stack the least recently used column. If there are no more columns left to stack, it returns false. Otherwise, true.

Returns:

getSceneWidth

private float getSceneWidth()

setSize

public void setSize(float height,
                    float width)