Skip to content

Commit

Permalink
#56 Starts implementing of News Corp View.
Browse files Browse the repository at this point in the history
  • Loading branch information
tuomount committed Jul 20, 2017
1 parent 826fb74 commit 7cd5d24
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/org/openRealmOfStars/game/GameState.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,9 @@ public enum GameState {
/**
* Diplomacy view
*/
DIPLOMACY_VIEW
DIPLOMACY_VIEW,
/**
* News corp view which will tell highlights of previous turn
*/
NEWS_CORP_VIEW
}
61 changes: 61 additions & 0 deletions src/main/java/org/openRealmOfStars/game/States/NewsCorpView.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package org.openRealmOfStars.game.States;

import java.awt.BorderLayout;
import java.awt.event.ActionListener;

import org.openRealmOfStars.game.GameCommands;
import org.openRealmOfStars.gui.buttons.SpaceButton;
import org.openRealmOfStars.gui.infopanel.InfoPanel;
import org.openRealmOfStars.gui.panels.BlackPanel;

/**
*
* Open Realm of Stars game project
* Copyright (C) 2017 Tuomo Untinen
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see http://www.gnu.org/licenses/
*
*
* News corp view to show highlights from previous turn
*
*/
public class NewsCorpView extends BlackPanel {

/**
*
*/
private static final long serialVersionUID = 1L;

/**
* Construtor for News Corp View.
* @param listener ActionListener
*/
public NewsCorpView(final ActionListener listener) {
this.setLayout(new BorderLayout());
InfoPanel base = new InfoPanel();
base.setLayout(new BorderLayout());
base.setTitle("Statistics");
this.add(base, BorderLayout.CENTER);
// Bottom panel
InfoPanel bottomPanel = new InfoPanel();
bottomPanel.setLayout(new BorderLayout());
bottomPanel.setTitle(null);
SpaceButton btn = new SpaceButton("Back to star map",
GameCommands.COMMAND_VIEW_STARMAP);
btn.addActionListener(listener);
bottomPanel.add(btn, BorderLayout.CENTER);
// Add panels to base
this.add(bottomPanel, BorderLayout.SOUTH);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package org.openRealmOfStars.game.States;

//import static org.junit.Assert.*;

import java.awt.event.ActionListener;

import org.junit.Test;
import org.mockito.Mockito;

/**
*
* Open Realm of Stars game project
* Copyright (C) 2017 Tuomo Untinen
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see http://www.gnu.org/licenses/
*
*
* News corp view to show highlights from previous turn
*
*/
public class NewsCorpViewTest {

@Test
public void testBasic() {
ActionListener listener = Mockito.mock(ActionListener.class);
new NewsCorpView(listener);
}

}

0 comments on commit 7cd5d24

Please sign in to comment.