-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#56 Starts implementing of News Corp View.
- Loading branch information
Showing
3 changed files
with
106 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
src/main/java/org/openRealmOfStars/game/States/NewsCorpView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
src/test/java/org/openRealmOfStars/game/States/NewsCorpViewTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|
||
} |