Kommentare und 2 Methoden, die jetzt kurz genug sind

git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@446 72836036-5685-4462-b002-a69064685172
This commit is contained in:
Ida Massow 2011-06-17 20:00:43 +02:00
parent 2c9f1d5d20
commit 4f71c5cb47
10 changed files with 149 additions and 60 deletions

View file

@ -35,9 +35,15 @@ public interface IGameListPanel {
* Sets the channel name
*
* @param name
* channel name
* channel name
*/
public void setChannelName(String name);
/**
* Set the games (host and player count) into the game list
*
* @param games
* list of game data
*/
public void setGameList(List<GameData> games);
}

View file

@ -37,10 +37,10 @@ public interface ISettingsPanel {
};
/**
* enables the start of a network game at a given point in game
* Sets the settings mode according to the point of the game
*
* @param enable
* starting a network game
* @param mode
* settings mode to be set (join, offer, network, default)
*/
public void setSettingsMode(SettingsMode mode);
@ -237,6 +237,12 @@ public interface ISettingsPanel {
*/
public IEvent getOfferGameEvent();
/**
* Sets the player colors which can be chosen
*
* @param colors
* a Set of colors which are not taken yet
*/
public void setPlayerColors(Set<Color> colors);
/**
@ -260,13 +266,14 @@ public interface ISettingsPanel {
/** Only computer players added */
COMPUTER_PLAYERS_ONLY_WARNING
}
/**
* SettingsPanel can be used with different functions in different situations
* SettingsPanel can be used with different functions in different
* situations
*/
public enum SettingsMode {
/**Local game settings */
DEFAULT,
/** Local game settings */
DEFAULT,
/** */
NETWORK_SETUP,
/** */

View file

@ -162,22 +162,70 @@ public interface IView {
*/
public IEvent1<File> getSaveEvent();
/**
* The pause event is emitted when the user wants to pause the current turn
*
* @return the event
*/
public IEvent getPauseEvent();
/**
* The end pause event is emitted when the user wants to sresume the game
* after a pause
*
* @return the event
*/
public IEvent getEndPauseEvent();
/**
* Hides all view elements and panels except for the cleared table and an
* empty hand panel
*/
public void clearView();
/**
* The network game event is emitted when the user chooses a network game
*
* @return the event
*/
public IEvent getNetworkGameEvent();
/**
* Getter for login panel
*
* @return login panel
*/
public ILoginPanel getLoginPanel();
/**
* Getter for game list panel
*
* @return game list panel
*/
public IGameListPanel getGameListPanel();
/**
* Show/hide login panel
*
* @param show
* true = login panel is shown
*/
public void showLoginPanel(boolean show);
/**
* Enable/disable pause mode
*
* @param enable
* true = enable
*/
public void enablePauseMode(boolean enable);
/**
* Show/hide game list panel
*
* @param show
* true = show
*/
public void showGameListPanel(boolean show);
/**

View file

@ -31,6 +31,8 @@ import jrummikub.util.IEvent1;
import jrummikub.view.IGameListPanel;
class GameListPanel extends JPanel implements IGameListPanel {
private static final long serialVersionUID = 1L;
private JLabel title;
private JList gameList;
private JButton joinButton;
@ -67,6 +69,13 @@ class GameListPanel extends JPanel implements IGameListPanel {
c.weighty = 0;
add(Box.createVerticalStrut(3), c);
addButtons(c);
setBorder(new CompoundBorder(new LineBorder(Color.BLACK),
new EmptyBorder(10, 10, 10, 10)));
}
private void addButtons(GridBagConstraints c) {
joinButton = new JButton("Beitreten");
c.gridwidth = 1;
add(joinButton, c);
@ -109,9 +118,6 @@ class GameListPanel extends JPanel implements IGameListPanel {
cancelEvent.emit();
}
});
setBorder(new CompoundBorder(new LineBorder(Color.BLACK), new EmptyBorder(
10, 10, 10, 10)));
}
void reset() {
@ -157,6 +163,7 @@ class GameListPanel extends JPanel implements IGameListPanel {
private static class GameDataCellRenderer extends JPanel implements
ListCellRenderer {
private static final long serialVersionUID = -892701906163443927L;
JLabel hostLabel, playerCountLabel;
GameDataCellRenderer() {
@ -193,7 +200,8 @@ class GameListPanel extends JPanel implements IGameListPanel {
int total = gameData.getGameSettings().getPlayerList().size();
int occupied = total;
for (PlayerSettings player : gameData.getGameSettings().getPlayerList()) {
for (PlayerSettings player : gameData.getGameSettings()
.getPlayerList()) {
if (player.getType() == Type.VACANT) {
occupied--;
}