|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container java.awt.Window java.awt.Frame javax.swing.JFrame jrummikub.view.impl.View
public class View
Implementation of the top-level view interface
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JFrame |
---|
javax.swing.JFrame.AccessibleJFrame |
Nested classes/interfaces inherited from class java.awt.Frame |
---|
java.awt.Frame.AccessibleAWTFrame |
Nested classes/interfaces inherited from class java.awt.Window |
---|
java.awt.Window.AccessibleAWTWindow |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Nested classes/interfaces inherited from interface jrummikub.view.IView |
---|
IView.BottomPanelType |
Fields inherited from class javax.swing.JFrame |
---|
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled |
Fields inherited from class java.awt.Frame |
---|
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface javax.swing.WindowConstants |
---|
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
View()
Create a new instance of the view |
Method Summary | |
---|---|
void |
clearView()
Hides all view elements and panels except for the cleared table and an empty hand panel |
private java.util.List<Pair<Stone,Position>> |
createDecorationStones()
|
private void |
createFileChooser()
|
private void |
createLayeredPane()
|
private void |
createMainLayer()
|
private void |
createMenuBar()
|
private javax.swing.JMenuItem |
createMenuItem(java.lang.String text,
Event event)
|
private void |
createSettingsPanel()
|
private void |
doSetBottomPanel(IView.BottomPanelType type)
|
void |
enablePauseMode(boolean enable)
Enable/disable pause mode |
void |
enableSave(boolean enable)
Enables/disables saving in menu bar |
private static int |
even(double d)
|
IEvent |
getAcknowledgeConnectionLostEvent()
The acknoledge connection lost event is emitted when the user has acknowledged that the network connection was lost |
IEvent |
getAcknowledgeInvalidEvent()
The start turn event is emitted when the player knows what invalid stones he played |
IConnectPanel |
getConnectPanel()
Getter for connect panel |
IEvent |
getEndPauseEvent()
The end pause event is emitted when the user wants to sresume the game after a pause |
IEvent |
getEndProgramEvent()
The quit event is emitted when the player wants to quit the game |
IGameListPanel |
getGameListPanel()
Getter for game list panel |
IHandPanel |
getHandPanel()
|
IEvent |
getLoadEvent()
The load event is emitted when the user wants to load a previously saved game state |
IEvent1<java.io.File> |
getLoadFileEvent()
The load file event is emitted when the user chose to discard the current game to save another |
ILoginPanel |
getLoginPanel()
Getter for login panel |
IEvent |
getMenuNewGameEvent()
The menu new game event is emitted when the user selects the new game menu entry |
IEvent |
getNetworkGameEvent()
The network game event is emitted when the user chooses a network game |
IEvent |
getNewGameEvent()
Is emitted if the player wants to end the game and start a new one |
IEvent |
getNewRoundEvent()
The new round event is emitted when the player wants to start a new round |
IEvent |
getPauseEvent()
The pause event is emitted when the user wants to pause the current turn |
IPlayerPanel |
getPlayerPanel()
Returns the player panel |
IEvent |
getQuitEvent()
The quit event is emitted when the user wants to leave the application |
IQuitWarningPanel |
getQuitWarningPanel()
Getter for quit warning panel |
IEvent1<java.io.File> |
getSaveEvent()
The save event is emitted when the user wants to save the current game state |
IScorePanel |
getScorePanel()
Returns the score panel |
ISettingsPanel |
getSettingsPanel()
Returns the settings panel |
ISidePanel |
getSidePanel()
Returns the side panel |
IEvent |
getStartTurnEvent()
The start turn event is emitted when the player wants to start his turn |
ITablePanel |
getTablePanel()
Returns the table |
void |
load()
Loading a game |
private void |
rescale()
|
private void |
rescaleSubpanel(javax.swing.JPanel sub,
double widthFactor,
double heightFactor,
int minWidth,
int minHeight)
|
void |
resetLoginPanel()
Clears user input of the resetLoginPanel |
private void |
save()
|
void |
setBottomPanel(IView.BottomPanelType type)
Sets the bottom panels type |
void |
setCurrentPlayerColor(java.awt.Color color)
Is used for the PlayerPanel and ScorePanel to display a player's color along with the name |
void |
setCurrentPlayerHasLaidOut(boolean hasLaidOut)
Is used for the PlayerPanel to display if a player has laid out along with the name |
void |
setCurrentPlayerName(java.lang.String playerName)
Sets the current player's name |
void |
setInitialMeldError(int points)
Is set if a player tried to lay out less than initial meld threshold |
void |
setInitialMeldFirstError()
Is set if the player tried to modify the table without laying out first |
void |
setInvalidStoneSets(java.util.Collection<StoneSet> sets)
Set invalid sets to enable showing |
void |
setLastStonePlayerName(java.lang.String name)
Sets the name of the player that has drawn the last stone |
void |
setMayPause(boolean mayPause)
Sets the pause button if pausing should be possible in the current situation |
void |
setRedealedPlayerName(java.lang.String name)
Sets the name of the player that has redealt last |
void |
setSelectedStones(java.util.Collection<Stone> stones)
Sets the stones that are to be painted selected |
void |
setStoneCollectionHidden(boolean enable)
Show stone collection |
void |
showConnectPanel(boolean show)
Set the connect panel visible |
void |
showGameListPanel(boolean show)
Show/hide game list panel |
void |
showLoadingError()
Show when loading is unsuccessful |
void |
showLoginPanel(boolean show)
Show/hide login panel |
void |
showQuitWarningPanel(boolean show)
Sets the quit warning panel visible |
void |
showScorePanel(boolean show)
Shows or hides the score panel |
void |
showServerStartupError(boolean alreadyRunning)
Show an error message when the server couldn't be started |
void |
showSettingsPanel(boolean show)
Shows or hides the game settings panel |
void |
showSidePanel(boolean show)
Show/hide side panel |
Methods inherited from class javax.swing.JFrame |
---|
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update |
Methods inherited from class java.awt.Frame |
---|
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated |
Methods inherited from class java.awt.Window |
---|
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, show, toBack, toFront |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.awt.MenuContainer |
---|
getFont, postEvent |
Field Detail |
---|
private static final float PLAYER_PANEL_RATIO
private static final int PLAYER_PANEL_MAX_HEIGHT
private static final int TABLE_BORDER_WIDTH
private javax.swing.JLayeredPane layeredPane
private javax.swing.JPanel mainLayer
private javax.swing.JMenuBar menuBar
private javax.swing.JMenuItem saveItem
private TablePanel table
private PlayerPanel playerPanel
private StartTurnPanel startTurnPanel
private PausePanel pausePanel
private RoundEndPanel roundEndPanel
private SettingsPanel settingsPanel
private LoginPanel loginPanel
private ScorePanel scorePanel
private GameListPanel gameListPanel
private SidePanel sidePanel
private QuitWarningPanel quitWarningPanel
private ConnectPanel connectPanel
private IView.BottomPanelType bottomPanelType
private javax.swing.JFileChooser chooser
private Event menuNewGameEvent
private Event networkGameEvent
private Event loadEvent
private Event1<java.io.File> loadFileEvent
private Event1<java.io.File> saveEvent
private Event quitEvent
private javax.swing.JFrame quitWarningFrame
Constructor Detail |
---|
public View()
Method Detail |
---|
private static int even(double d)
public ISettingsPanel getSettingsPanel()
IView
getSettingsPanel
in interface IView
public ILoginPanel getLoginPanel()
IView
getLoginPanel
in interface IView
public IScorePanel getScorePanel()
IView
getScorePanel
in interface IView
public ITablePanel getTablePanel()
IView
getTablePanel
in interface IView
public ISidePanel getSidePanel()
IView
getSidePanel
in interface IView
public IHandPanel getHandPanel()
getHandPanel
in interface IView
public IPlayerPanel getPlayerPanel()
IView
getPlayerPanel
in interface IView
public IQuitWarningPanel getQuitWarningPanel()
IView
getQuitWarningPanel
in interface IView
public IConnectPanel getConnectPanel()
IView
getConnectPanel
in interface IView
public IGameListPanel getGameListPanel()
IView
getGameListPanel
in interface IView
public IEvent getMenuNewGameEvent()
IView
getMenuNewGameEvent
in interface IView
public IEvent1<java.io.File> getLoadFileEvent()
IView
getLoadFileEvent
in interface IView
public IEvent getLoadEvent()
IView
getLoadEvent
in interface IView
public IEvent1<java.io.File> getSaveEvent()
IView
getSaveEvent
in interface IView
public IEvent getPauseEvent()
IView
getPauseEvent
in interface IView
public IEvent getEndPauseEvent()
IView
getEndPauseEvent
in interface IView
public IEvent getNetworkGameEvent()
IView
getNetworkGameEvent
in interface IView
public IEvent getQuitEvent()
IView
getQuitEvent
in interface IView
public void clearView()
IView
clearView
in interface IView
public void showLoadingError()
IView
showLoadingError
in interface IView
public void showServerStartupError(boolean alreadyRunning)
IView
showServerStartupError
in interface IView
alreadyRunning
- true when the server is already running on this machineprivate void createFileChooser()
private void createMenuBar()
private javax.swing.JMenuItem createMenuItem(java.lang.String text, Event event)
public void enableSave(boolean enable)
IView
enableSave
in interface IView
enable
- saving possiblepublic void load()
IView
load
in interface IView
private void save()
private void createLayeredPane()
private void createSettingsPanel()
private void createMainLayer()
public void setMayPause(boolean mayPause)
IView
setMayPause
in interface IView
mayPause
- pausing possiblepublic void enablePauseMode(boolean enable)
IView
enablePauseMode
in interface IView
enable
- true = enableprivate void rescale()
private void rescaleSubpanel(javax.swing.JPanel sub, double widthFactor, double heightFactor, int minWidth, int minHeight)
public void setSelectedStones(java.util.Collection<Stone> stones)
IView
setSelectedStones
in interface IView
stones
- the stones to be painted selectedpublic void setInvalidStoneSets(java.util.Collection<StoneSet> sets)
IView
setInvalidStoneSets
in interface IView
sets
- invalid sets on tablepublic void showSettingsPanel(boolean show)
IView
showSettingsPanel
in interface IView
show
- specifies if the panel shall be shown or hiddenpublic void showLoginPanel(boolean show)
IView
showLoginPanel
in interface IView
show
- true = login panel is shownpublic void resetLoginPanel()
IView
resetLoginPanel
in interface IView
public void showGameListPanel(boolean show)
IView
showGameListPanel
in interface IView
show
- true = showpublic void showScorePanel(boolean show)
IView
showScorePanel
in interface IView
show
- specifies if the panel shall be shown or hiddenpublic void showSidePanel(boolean show)
IView
showSidePanel
in interface IView
show
- true to showpublic void showQuitWarningPanel(boolean show)
IView
showQuitWarningPanel
in interface IView
show
- is visiblepublic void showConnectPanel(boolean show)
IView
showConnectPanel
in interface IView
show
- is visiblepublic void setCurrentPlayerName(java.lang.String playerName)
IView
setCurrentPlayerName
in interface IView
playerName
- the player namepublic void setInitialMeldError(int points)
IView
setInitialMeldError
in interface IView
points
- initial meld thresholdpublic void setInitialMeldFirstError()
IView
setInitialMeldFirstError
in interface IView
public void setCurrentPlayerColor(java.awt.Color color)
IView
setCurrentPlayerColor
in interface IView
color
- the current player's colorpublic void setRedealedPlayerName(java.lang.String name)
IView
setRedealedPlayerName
in interface IView
name
- the player namepublic void setLastStonePlayerName(java.lang.String name)
IView
setLastStonePlayerName
in interface IView
name
- the player namepublic void setCurrentPlayerHasLaidOut(boolean hasLaidOut)
IView
setCurrentPlayerHasLaidOut
in interface IView
hasLaidOut
- specifies if the current player has laid out or notpublic IEvent getStartTurnEvent()
IView
getStartTurnEvent
in interface IView
public IEvent getAcknowledgeInvalidEvent()
IView
getAcknowledgeInvalidEvent
in interface IView
public IEvent getAcknowledgeConnectionLostEvent()
IView
getAcknowledgeConnectionLostEvent
in interface IView
public IEvent getNewRoundEvent()
IView
getNewRoundEvent
in interface IView
public IEvent getNewGameEvent()
IView
getNewGameEvent
in interface IView
public IEvent getEndProgramEvent()
IView
getEndProgramEvent
in interface IView
private java.util.List<Pair<Stone,Position>> createDecorationStones()
public void setBottomPanel(IView.BottomPanelType type)
IView
setBottomPanel
in interface IView
type
- the type of the bottom panelprivate void doSetBottomPanel(IView.BottomPanelType type)
public void setStoneCollectionHidden(boolean enable)
IView
setStoneCollectionHidden
in interface IView
enable
- showing collection
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |