gui.dialogs
Class MainDialog

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Window
              extended byjava.awt.Dialog
                  extended byjavax.swing.JDialog
                      extended bygui.dialogs.MainDialog
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.RootPaneContainer, java.io.Serializable, javax.swing.WindowConstants

public final class MainDialog
extends javax.swing.JDialog
implements java.awt.event.ActionListener

A main dialog window of an application.

Author:
Piotrek
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JDialog
javax.swing.JDialog.AccessibleJDialog
 
Nested classes inherited from class java.awt.Dialog
java.awt.Dialog.AccessibleAWTDialog
 
Nested classes inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  javax.swing.JButton addAirportButton
          The `add airport' button placed on the toolbar.
private  javax.swing.JButton addBusStopButton
          The `add bus stop' button placed on the toolbar.
private  javax.swing.JButton addCityButton
          The `add city' button placed on the toolbar.
private  javax.swing.JButton addConnectionButton
          The `add connection' button placed on the toolbar.
private  javax.swing.JButton addHarbourButton
          The `add harbour' button placed on the toolbar.
private  javax.swing.JButton addTrainStationButton
          The `add train station' button placed on the toolbar.
private  AirportPropertiesPanel airportPropertiesPanel
          A panel containing a set of properties of an airport.
private  BusStopPropertiesPanel busStopPropertiesPanel
          A panel containing a set of properties of a bus stop.
private  CityPropertiesPanel cityPropertiesPanel
          A panel containing a set of properties of a city.
private  javax.swing.JButton configButton
          The `config' button placed on the toolbar.
private  ConnectionEditChooser connectionEditChooser
          A panel used to choose a connection to be edited or removed.
private  SchedulerCRNManager crnManager
          An instance of CRN manager used to take care of history handling.
private  javax.swing.JButton editAirportButton
          The `edit airport' button placed on the toolbar.
private  javax.swing.JButton editBusStopButton
          The `edit bus stop' button placed on the toolbar.
private  javax.swing.JButton editCityButton
          The `edit city' button placed on the toolbar.
private  javax.swing.JButton editConnectionButton
          The `edit connection' button placed on the toolbar.
private  javax.swing.JButton editHarbourButton
          The `edit harbour' button placed on the toolbar.
private  javax.swing.JButton editionPanelSwitchButton
          A button used to switch between the edition and visibility toolbar panels.
private  javax.swing.JPanel editionToolbarPanel
          A panel containing the edition buttons.
private  javax.swing.JButton editTrainStationButton
          The `edit train station' button placed on the toolbar.
private  javax.swing.JButton exitButton
          A `exit' button.
private  java.util.ArrayList firstStepSolutions
          A list of the solutions found by the first step of the travel scheduling algorithm.
private  HarbourPropertiesPanel harbourPropertiesPanel
          A panel containing a set of properties of a harbour.
private  javax.swing.JButton loadMapButton
          A `load map' button.
private  LocationsChooser locationsChooser
          A locations chooser panel.
private  javax.swing.JButton newMapButton
          A `new map' button.
private  java.awt.Container panel
          A main panel of this dialog.
private  javax.swing.JButton saveMapButton
          A `save map' button.
private  javax.swing.JButton showHideAirConnectionsButton
          A button used to show/hide the air connections.
private  javax.swing.JButton showHideAirportsNamesButton
          A button used to show/hide the names of the airports.
private  javax.swing.JButton showHideBusConnectionsButton
          A button used to show/hide the bus connections.
private  javax.swing.JButton showHideBusStopsNamesButton
          A button used to show/hide the names of the bus stops.
private  javax.swing.JButton showHideCitiesNamesButton
          A button used to show/hide names of the cities.
private  javax.swing.JButton showHideConnectionsButton
          The `show/hide connections' button placed on the toolbar.
private  javax.swing.JButton showHideHarboursNamesButton
          A button used to show/hide the names of the harbours.
private  javax.swing.JButton showHideNamesButton
          The `show/hide names' button placed on the toolbar.
private  javax.swing.JButton showHideRailwayConnectionsButton
          A button used to show/hide the railway connections.
private  javax.swing.JButton showHideSeaConnectionsButton
          A button used to show/hide the sea connections.
private  javax.swing.JButton showHideTrainStationsNamesButton
          A button used to show/hide the names of the train stations.
private  StationsChooser stationsChooser
          A panel used to build a list of stations when defining a new connection.
private  javax.swing.JButton testButton
          The `test' button placed on the toolbar.
private  TrainStationPropertiesPanel trainStationPropertiesPanel
          A panel containing a set of properties of a train station.
private  TravelConstraints travelConstraints
          The current travek constraints.
private  TravelDivisionsChooser travelDivisionsChooser
          A travel divisions chooser panel.
private  TravelSolutionsChooser travelSolutionsChooser
          A travel solutions chooser panel.
private  javax.swing.JButton visibilityPanelSwitchButton
          A button used to switch between the visibility and edition toolbar panels.
private  javax.swing.JPanel visibilityToolbarPanel
          A panel containing the visibility options.
private  WorldView worldView
          A view panel.
private  javax.swing.JButton zoomInButton
          The `zoom in' button placed on the toolbar.
private  javax.swing.JButton zoomOutButton
          The `zoom out' button placed on the toolbar.
 
Fields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Dialog
 
Fields inherited from class java.awt.Window
 
Fields inherited from class java.awt.Container
 
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, EXIT_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
MainDialog(java.lang.String title)
          Constructor.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
private  void AddMenuPanel()
          Adds a menu panel to this dialog.
private  void AddPropertiesPanel()
          Adds a properties panel to this dialog.
private  void AddToolbarPanel()
          Adds a toolbar panel to this dialog.
private  void AddViewPanel()
          Adds a view panel to this dialog.
 void dispose()
           
 AirportPropertiesPanel GetAirportPropertiesPanel()
          Gets the airport properties panel.
 BusStopPropertiesPanel GetBusStopPropertiesPanel()
          Gets the bus stop properties panel.
 CityPropertiesPanel GetCityPropertiesPanel()
          Gets the city properties panel.
 CRN GetCRN()
          Gets the CRN used by this CRN manager.
 HarbourPropertiesPanel GetHarbourPropertiesPanel()
          Gets the harbour properties panel.
 LocationsChooser GetLocationsChooser()
          Gets the locations chooser.
 TrainStationPropertiesPanel GetTrainStationPropertiesPanel()
          Gets the train station properties panel.
private  void HideAllPropertiesControls()
          Hides all controls that are displayed in the properites panel.
 void HideStationsChooser()
          Hides the stations chooser control and switches the view into the normal view mode.
 void LaunchFirstStepSolver()
          Runs a solver of the first step of the travel scheduling algorithm.
private  void LockButtons(boolean fLock)
          Locks all the buttons but the zoom in/out, exit and show/hide buttons.
 void OnFirstStepReady(java.util.ArrayList firstStepSolutions)
          Called once the first step of the travel scheduling algorithm is solved.
private  void OnLoadWorld()
          Loads a world from the file given by the user.
private  void OnSaveWorld()
          Saves a world to the file given by the user.
 void OnSchedulingAlgorithmStepError(java.lang.String errorMessage)
          Called if there was an error while solving the second step of the travel scheduling algorithm.
 void OnSecondStepReady(java.util.ArrayList secondStepSolutions)
          Called once the second step of the travel scheduling algorithm is solved.
 
Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Dialog
addNotify, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setResizable, setTitle, setUndecorated, show
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, finalize, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, 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, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, removeNotify, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, transferFocusBackward, 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, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, 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, isOpaque, 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, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

panel

private java.awt.Container panel
A main panel of this dialog.


newMapButton

private javax.swing.JButton newMapButton
A `new map' button.


loadMapButton

private javax.swing.JButton loadMapButton
A `load map' button.


saveMapButton

private javax.swing.JButton saveMapButton
A `save map' button.


exitButton

private javax.swing.JButton exitButton
A `exit' button.


travelDivisionsChooser

private TravelDivisionsChooser travelDivisionsChooser
A travel divisions chooser panel.


travelSolutionsChooser

private TravelSolutionsChooser travelSolutionsChooser
A travel solutions chooser panel.


locationsChooser

private LocationsChooser locationsChooser
A locations chooser panel.


connectionEditChooser

private ConnectionEditChooser connectionEditChooser
A panel used to choose a connection to be edited or removed.


cityPropertiesPanel

private CityPropertiesPanel cityPropertiesPanel
A panel containing a set of properties of a city.


airportPropertiesPanel

private AirportPropertiesPanel airportPropertiesPanel
A panel containing a set of properties of an airport.


trainStationPropertiesPanel

private TrainStationPropertiesPanel trainStationPropertiesPanel
A panel containing a set of properties of a train station.


busStopPropertiesPanel

private BusStopPropertiesPanel busStopPropertiesPanel
A panel containing a set of properties of a bus stop.


harbourPropertiesPanel

private HarbourPropertiesPanel harbourPropertiesPanel
A panel containing a set of properties of a harbour.


stationsChooser

private StationsChooser stationsChooser
A panel used to build a list of stations when defining a new connection.


showHideAirportsNamesButton

private javax.swing.JButton showHideAirportsNamesButton
A button used to show/hide the names of the airports.


showHideAirConnectionsButton

private javax.swing.JButton showHideAirConnectionsButton
A button used to show/hide the air connections.


showHideBusStopsNamesButton

private javax.swing.JButton showHideBusStopsNamesButton
A button used to show/hide the names of the bus stops.


showHideBusConnectionsButton

private javax.swing.JButton showHideBusConnectionsButton
A button used to show/hide the bus connections.


showHideTrainStationsNamesButton

private javax.swing.JButton showHideTrainStationsNamesButton
A button used to show/hide the names of the train stations.


showHideRailwayConnectionsButton

private javax.swing.JButton showHideRailwayConnectionsButton
A button used to show/hide the railway connections.


showHideHarboursNamesButton

private javax.swing.JButton showHideHarboursNamesButton
A button used to show/hide the names of the harbours.


showHideSeaConnectionsButton

private javax.swing.JButton showHideSeaConnectionsButton
A button used to show/hide the sea connections.


showHideCitiesNamesButton

private javax.swing.JButton showHideCitiesNamesButton
A button used to show/hide names of the cities.


editionToolbarPanel

private javax.swing.JPanel editionToolbarPanel
A panel containing the edition buttons.


visibilityToolbarPanel

private javax.swing.JPanel visibilityToolbarPanel
A panel containing the visibility options.


editionPanelSwitchButton

private javax.swing.JButton editionPanelSwitchButton
A button used to switch between the edition and visibility toolbar panels.


visibilityPanelSwitchButton

private javax.swing.JButton visibilityPanelSwitchButton
A button used to switch between the visibility and edition toolbar panels.


addCityButton

private javax.swing.JButton addCityButton
The `add city' button placed on the toolbar.


editCityButton

private javax.swing.JButton editCityButton
The `edit city' button placed on the toolbar.


zoomInButton

private javax.swing.JButton zoomInButton
The `zoom in' button placed on the toolbar.


zoomOutButton

private javax.swing.JButton zoomOutButton
The `zoom out' button placed on the toolbar.


addAirportButton

private javax.swing.JButton addAirportButton
The `add airport' button placed on the toolbar.


editAirportButton

private javax.swing.JButton editAirportButton
The `edit airport' button placed on the toolbar.


addTrainStationButton

private javax.swing.JButton addTrainStationButton
The `add train station' button placed on the toolbar.


editTrainStationButton

private javax.swing.JButton editTrainStationButton
The `edit train station' button placed on the toolbar.


addBusStopButton

private javax.swing.JButton addBusStopButton
The `add bus stop' button placed on the toolbar.


editBusStopButton

private javax.swing.JButton editBusStopButton
The `edit bus stop' button placed on the toolbar.


addHarbourButton

private javax.swing.JButton addHarbourButton
The `add harbour' button placed on the toolbar.


editHarbourButton

private javax.swing.JButton editHarbourButton
The `edit harbour' button placed on the toolbar.


showHideNamesButton

private javax.swing.JButton showHideNamesButton
The `show/hide names' button placed on the toolbar.


testButton

private javax.swing.JButton testButton
The `test' button placed on the toolbar.


configButton

private javax.swing.JButton configButton
The `config' button placed on the toolbar.


showHideConnectionsButton

private javax.swing.JButton showHideConnectionsButton
The `show/hide connections' button placed on the toolbar.


addConnectionButton

private javax.swing.JButton addConnectionButton
The `add connection' button placed on the toolbar.


editConnectionButton

private javax.swing.JButton editConnectionButton
The `edit connection' button placed on the toolbar.


worldView

private WorldView worldView
A view panel.


crnManager

private SchedulerCRNManager crnManager
An instance of CRN manager used to take care of history handling.


travelConstraints

private TravelConstraints travelConstraints
The current travek constraints.


firstStepSolutions

private java.util.ArrayList firstStepSolutions
A list of the solutions found by the first step of the travel scheduling algorithm.

Constructor Detail

MainDialog

public MainDialog(java.lang.String title)
Constructor.

Parameters:
title - The title of the window.
Method Detail

AddMenuPanel

private void AddMenuPanel()
Adds a menu panel to this dialog.


AddPropertiesPanel

private void AddPropertiesPanel()
Adds a properties panel to this dialog.


AddToolbarPanel

private void AddToolbarPanel()
Adds a toolbar panel to this dialog.


AddViewPanel

private void AddViewPanel()
Adds a view panel to this dialog.


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener
See Also:
ActionListener.actionPerformed(java.awt.event.ActionEvent)

GetCRN

public CRN GetCRN()
Gets the CRN used by this CRN manager.

Returns:
The requested CRN.

OnSaveWorld

private void OnSaveWorld()
Saves a world to the file given by the user.


OnLoadWorld

private void OnLoadWorld()
Loads a world from the file given by the user.


HideAllPropertiesControls

private void HideAllPropertiesControls()
Hides all controls that are displayed in the properites panel.


HideStationsChooser

public void HideStationsChooser()
Hides the stations chooser control and switches the view into the normal view mode. It is called by a timetable editor when it has finished edition of a new connection.


GetCityPropertiesPanel

public CityPropertiesPanel GetCityPropertiesPanel()
Gets the city properties panel.

Returns:
The requested panel.

GetAirportPropertiesPanel

public AirportPropertiesPanel GetAirportPropertiesPanel()
Gets the airport properties panel.

Returns:
The requested panel.

GetTrainStationPropertiesPanel

public TrainStationPropertiesPanel GetTrainStationPropertiesPanel()
Gets the train station properties panel.

Returns:
The requested panel.

GetBusStopPropertiesPanel

public BusStopPropertiesPanel GetBusStopPropertiesPanel()
Gets the bus stop properties panel.

Returns:
The requested panel.

GetHarbourPropertiesPanel

public HarbourPropertiesPanel GetHarbourPropertiesPanel()
Gets the harbour properties panel.

Returns:
The requested panel.

LockButtons

private void LockButtons(boolean fLock)
Locks all the buttons but the zoom in/out, exit and show/hide buttons.

Parameters:
fLock - Indicates whether to lock the buttons.

LaunchFirstStepSolver

public void LaunchFirstStepSolver()
Runs a solver of the first step of the travel scheduling algorithm.


OnFirstStepReady

public void OnFirstStepReady(java.util.ArrayList firstStepSolutions)
Called once the first step of the travel scheduling algorithm is solved.

Parameters:
firstStepSolutions - A set of first step solutions.

OnSecondStepReady

public void OnSecondStepReady(java.util.ArrayList secondStepSolutions)
Called once the second step of the travel scheduling algorithm is solved.

Parameters:
secondStepSolutions - A set of second step solutions.

OnSchedulingAlgorithmStepError

public void OnSchedulingAlgorithmStepError(java.lang.String errorMessage)
Called if there was an error while solving the second step of the travel scheduling algorithm. It shows a message box to the user.

Parameters:
errorMessage - A message shown to the user.

GetLocationsChooser

public LocationsChooser GetLocationsChooser()
Gets the locations chooser. It can be used to get the origin and destination for the test.

Returns:
A currently used locations chooser.

dispose

public void dispose()
See Also:
Window.dispose()