Class SwingViewImpl

java.lang.Object
pvzclone.view.impl.SwingViewImpl
All Implemented Interfaces:
View

public final class SwingViewImpl extends Object implements View
Implementation of the View.
  • Field Details

    • APPLICATION_WIDTH

      public static final int APPLICATION_WIDTH
      Application Width.
      See Also:
    • APPLICATION_HEIGHT

      public static final int APPLICATION_HEIGHT
      Application Height.
      See Also:
    • APPLICATION_TITLE

      public static final String APPLICATION_TITLE
      Application Title.
      See Also:
    • LEVEL_PANEL_CONSTRAINT

      public static final String LEVEL_PANEL_CONSTRAINT
      Level Panel's Textual Constraint.
      See Also:
    • GAME_PANEL_CONSTRAINT

      public static final String GAME_PANEL_CONSTRAINT
      Game Panel's Textual Constraint.
      See Also:
  • Constructor Details

    • SwingViewImpl

      public SwingViewImpl(Controller controller)
      View Implementation Constructor.
      Parameters:
      controller - the Application's Controller.
  • Method Details

    • getController

      public Controller getController()
      Returns the Application's Controller.
      Specified by:
      getController in interface View
      Returns:
      the Application's Controller.
    • setScene

      public void setScene(String scene)
      Sets a new Scene.
      Specified by:
      setScene in interface View
      Parameters:
      scene - the scene constraint to be setted.
    • getSceneConstraint

      public String getSceneConstraint()
      Returns the actual scene constraint.
      Specified by:
      getSceneConstraint in interface View
      Returns:
      the current scene constraint.
    • update

      public void update()
      Updates the View.
      Specified by:
      update in interface View
      See Also:
    • endGame

      public void endGame(Optional<Boolean> win)
      Description copied from interface: View
      The End Game handler.
      Specified by:
      endGame in interface View
      Parameters:
      win - if the player won or lose.
    • getScale

      public Pair<Double,Double> getScale()
      Description copied from interface: View
      Returns the scaled X and Y relative to their original dimensions. If the window dimension was not modified, their value should be both 1.
      Specified by:
      getScale in interface View
      Returns:
      a pair of the scaled dimensions